提交 66fabf6a 编写于 作者: L libb

frame01

Change-Id: I9924b48e126687829fcc546a96482806f60fa0ca
上级 b55ffd3f
......@@ -14,6 +14,8 @@
042C446E21C39582005E1671 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 042C446C21C39582005E1671 /* LaunchScreen.storyboard */; };
042C447121C39582005E1671 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 042C447021C39582005E1671 /* main.m */; };
044CC96321D5D74900D41611 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 044CC96121D5D74900D41611 /* Security.framework */; };
04E212E5222F9BA500EC8ED7 /* UILabel+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 04E212E0222F9BA500EC8ED7 /* UILabel+Extension.m */; };
04E212E6222F9BA500EC8ED7 /* UIButton+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 04E212E3222F9BA500EC8ED7 /* UIButton+Extension.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
......@@ -46,6 +48,10 @@
042C447021C39582005E1671 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
044CC96121D5D74900D41611 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
04E212BE222F6D0500EC8ED7 /* LLTool.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = LLTool.xcodeproj; path = ../../../sdk/LLTool/LLTool.xcodeproj; sourceTree = "<group>"; };
04E212E0222F9BA500EC8ED7 /* UILabel+Extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UILabel+Extension.m"; sourceTree = "<group>"; };
04E212E1222F9BA500EC8ED7 /* UIButton+Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIButton+Extension.h"; sourceTree = "<group>"; };
04E212E2222F9BA500EC8ED7 /* UILabel+Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UILabel+Extension.h"; sourceTree = "<group>"; };
04E212E3222F9BA500EC8ED7 /* UIButton+Extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIButton+Extension.m"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
......@@ -80,6 +86,7 @@
042C446021C3957D005E1671 /* frame01 */ = {
isa = PBXGroup;
children = (
04E212DF222F9BA500EC8ED7 /* Category */,
04E212BE222F6D0500EC8ED7 /* LLTool.xcodeproj */,
042C446121C3957D005E1671 /* AppDelegate.h */,
042C446221C3957D005E1671 /* AppDelegate.m */,
......@@ -110,6 +117,17 @@
name = Products;
sourceTree = "<group>";
};
04E212DF222F9BA500EC8ED7 /* Category */ = {
isa = PBXGroup;
children = (
04E212E0222F9BA500EC8ED7 /* UILabel+Extension.m */,
04E212E1222F9BA500EC8ED7 /* UIButton+Extension.h */,
04E212E2222F9BA500EC8ED7 /* UILabel+Extension.h */,
04E212E3222F9BA500EC8ED7 /* UIButton+Extension.m */,
);
path = Category;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
......@@ -197,6 +215,8 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
04E212E6222F9BA500EC8ED7 /* UIButton+Extension.m in Sources */,
04E212E5222F9BA500EC8ED7 /* UILabel+Extension.m in Sources */,
042C446621C3957D005E1671 /* ViewController.m in Sources */,
042C447121C39582005E1671 /* main.m in Sources */,
042C446321C3957D005E1671 /* AppDelegate.m in Sources */,
......@@ -354,9 +374,10 @@
"$(inherited)",
"@executable_path/Frameworks",
);
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = com.bairuitech.frame01;
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = 1;
};
name = Debug;
};
......@@ -371,9 +392,10 @@
"$(inherited)",
"@executable_path/Frameworks",
);
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = com.bairuitech.frame01;
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = 1;
};
name = Release;
};
......
//
// UIButton+Extension.h
// text
//
// Created by 格式化油条 on 15/9/10.
// Copyright (c) 2015年 XQBoy. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIButton (Extension)
/** 创建按钮,设置按钮文字,文字颜色默认灰色,文字大小默认15 */
+ (instancetype)buttonWithTitle:(NSString *)title atTarget:(id)target atAction:(SEL)action;
/** 创建按钮,设置按钮文字与大小,文字颜色默认灰色 */
+ (instancetype)buttonWithTitle:(NSString *)title atTitleSize:(CGFloat)size atTarget:(id)target atAction:(SEL)action;
/** 创建按钮,设置按钮文字与文字颜色,文字大小默认15 */
+ (instancetype)buttonWithTitle:(NSString *)title atTitleColor:(UIColor *)color atTarget:(id)target atAction:(SEL)action;
/** 创建按钮,设置按钮文字、文字颜色与文字大小 */
+ (instancetype)buttonWithTitle:(NSString *)title atTitleSize:(CGFloat)size atTitleColor:(UIColor *)color atTarget:(id)target atAction:(SEL)action;
/** 创建带有图片与文字的按钮,文字颜色默认为灰色 */
+ (instancetype)buttonWithTitle:(NSString *)title atNormalImageName:(NSString *)normalImageName atSelectedImageName:(NSString *)selectedImageName atTarget:(id)target atAction:(SEL)action;
/** 创建带有背景图片与文字的按钮,文字颜色默认为灰色 */
+ (instancetype)buttonWithTitle:(NSString *)title atBackgroundNormalImageName:(NSString *)BackgroundImageName atBackgroundSelectedImageName:(NSString *)BackgroundselectedImageName atTarget:(id)target atAction:(SEL)action;
@end
//
// UIButton+Extension.m
// text
//
// Created by 格式化油条 on 15/9/10.
// Copyright (c) 2015年 XQBoy. All rights reserved.
//
#import "UIButton+Extension.h"
#import <LLTool/LLTool.h>
@implementation UIButton (Extension)
/** 创建按钮,设置按钮文字,文字颜色默认灰色,文字大小默认15 */
+ (instancetype)buttonWithTitle:(NSString *)title atTarget:(id)target atAction:(SEL)action {
return [self buttonWithTitle:title atTitleSize:0 atTitleColor:nil atTarget:target atAction:action];
}
/** 创建按钮,设置按钮文字与大小,文字颜色默认灰色 */
+ (instancetype)buttonWithTitle:(NSString *)title atTitleSize:(CGFloat)size atTarget:(id)target atAction:(SEL)action {
return [self buttonWithTitle:title atTitleSize:size atTitleColor:nil atTarget:target atAction:action];
}
/** 创建按钮,设置按钮文字与文字颜色,文字大小默认15 */
+ (instancetype)buttonWithTitle:(NSString *)title atTitleColor:(UIColor *)color atTarget:(id)target atAction:(SEL)action {
return [self buttonWithTitle:title atTitleSize:0 atTitleColor:color atTarget:target atAction:action];
}
/** 创建按钮,设置按钮文字、文字颜色与文字大小 */
+ (instancetype)buttonWithTitle:(NSString *)title atTitleSize:(CGFloat)size atTitleColor:(UIColor *)color atTarget:(id)target atAction:(SEL)action {
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setTitle:title forState:UIControlStateNormal];
[button.titleLabel setFont:[UIFont systemFontOfSize: (size ? : 15 )]];
[button setTitleColor:(color ? : [UIColor grayColor]) forState:UIControlStateNormal];
[button addTarget:target action:action forControlEvents:UIControlEventTouchDown];
return button;
}
/** 创建带有图片与文字的按钮 */
+ (instancetype)buttonWithTitle:(NSString *)title atNormalImageName:(NSString *)normalImageName atSelectedImageName:(NSString *)selectedImageName atTarget:(id)target atAction:(SEL)action {
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setTitle:title forState:UIControlStateNormal];
[button setTitleColor:RGB(192, 192, 192) forState:UIControlStateNormal];
[button setImage:(normalImageName ? [UIImage imageNamed:normalImageName] : nil) forState:UIControlStateNormal];
[button setImage:(selectedImageName ? [UIImage imageNamed:selectedImageName] : nil) forState:UIControlStateSelected];
button.titleEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0);
[button.titleLabel setFont:FONTS(15)];
[button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
return button;
}
/** 创建带有图片与文字的按钮 */
+ (instancetype)buttonWithTitle:(NSString *)title atBackgroundNormalImageName:(NSString *)BackgroundImageName atBackgroundSelectedImageName:(NSString *)BackgroundselectedImageName atTarget:(id)target atAction:(SEL)action {
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
/** 设置标题 */
[button setTitle:title forState:UIControlStateNormal];
/** 设置字体颜色 */
[button setTitleColor:RGB(192, 192, 192) forState:UIControlStateNormal];
/** 普通背景图 */
[button setBackgroundImage:(BackgroundImageName ? [UIImage imageNamed:BackgroundImageName] : nil) forState:UIControlStateNormal];
/** 选中背景图 */
[button setBackgroundImage:(BackgroundselectedImageName ? [UIImage imageNamed:BackgroundselectedImageName] : nil) forState:UIControlStateSelected];
/** 添加点击事件 */
[button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
/** 设置字体 */
[button.titleLabel setFont:FONTS(15)];
return button;
}
@end
//
// UILabel+Extension.h
// text
//
// Created by 格式化油条 on 15/9/10.
// Copyright (c) 2015年 XQBoy. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UILabel (Extension)
/** 创建label,默认文字颜色为灰色,文字大小为15 */
+ (instancetype)labelWithText:(NSString *)text;
/** 创建label,自定义文字颜色,默认文字大小为15 */
+ (instancetype)labelWithText:(NSString *)text atColor:(UIColor *)color;
/** 自定义文字大小与颜色 */
+ (instancetype)labelWithText:(NSString *)text atColor:(UIColor *)color atTextSize:(CGFloat)size;
@end
//
// UILabel+Extension.m
// text
//
// Created by 格式化油条 on 15/9/10.
// Copyright (c) 2015年 XQBoy. All rights reserved.
//
#import "UILabel+Extension.h"
@implementation UILabel (Extension)
/** 创建label,默认文字颜色为灰色,文字大小为14 */
+ (instancetype)labelWithText:(NSString *)text {
return [self labelWithText:text atColor:nil];
}
/** 创建label,自定义文字颜色,默认文字大小为14 */
+ (instancetype)labelWithText:(NSString *)text atColor:(UIColor *)color {
return [self labelWithText:text atColor:color atTextSize:0];
}
/** 自定义文字大小与颜色 */
+ (instancetype)labelWithText:(NSString *)text atColor:(UIColor *)color atTextSize:(CGFloat)size {
UILabel *label = [[self alloc] init];
[label setText:text];
[label setTextColor:color ? : [UIColor blackColor]];
[label setFont:[UIFont systemFontOfSize:size ? : 14]];
return label;
}
@end
......@@ -12,6 +12,8 @@
@interface ViewController ()
@property (nonatomic,strong) LLSettingView *settingView;
@end
@implementation ViewController
......@@ -20,12 +22,30 @@
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
LLColorView *colorView = [[LLColorView alloc] initWithFrame:CGRectZero];
colorView.frame = CGRectMake(0, 0, 200, 200);
colorView.backgroundColor = [UIColor redColor];
// LLColorView *colorView = [[LLColorView alloc] initWithFrame:CGRectZero];
// colorView.frame = CGRectMake(0, 0, 200, 200);
// colorView.backgroundColor = [UIColor redColor];
//
// [self.view addSubview:colorView];
self.settingView.backgroundColor = [UIColor clearColor];
LLSettingViewAdapter *adapter = [[LLSettingViewAdapter alloc] init];
__weak typeof(self) weakSelf = self;
adapter.settingButtonClickBlock = ^(UIButton *button, int style) {
// [weakSelf settingBtnClick:button style:style];
};
[self.view addSubview:colorView];
self.settingView.adapter = adapter;
CGRect frame = self.settingView.frame;
frame.origin.x = SCREEN_WIDTH-AC_WIDTH_FIT(44+15);
self.settingView.frame = frame;
}
......@@ -34,5 +54,14 @@
// Dispose of any resources that can be recreated.
}
- (LLSettingView *)settingView {
if (_settingView == nil) {
_settingView = [[LLSettingView alloc] initWithFrame:CGRectMake(0, 0, AC_WIDTH_FIT(44), 300)];
[self.view addSubview:_settingView];
}
return _settingView;
}
@end
......@@ -26,6 +26,14 @@
042C445421C39536005E1671 /* LLColorView.m in Sources */ = {isa = PBXBuildFile; fileRef = 042C445221C39536005E1671 /* LLColorView.m */; };
044110DA21ED6D80006FB01D /* LLCertHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 044110D821ED6D80006FB01D /* LLCertHelper.h */; settings = {ATTRIBUTES = (Public, ); }; };
044110DB21ED6D80006FB01D /* LLCertHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 044110D921ED6D80006FB01D /* LLCertHelper.m */; };
04E212CC222F71E700EC8ED7 /* LLSettingView.h in Headers */ = {isa = PBXBuildFile; fileRef = 04E212CA222F71E700EC8ED7 /* LLSettingView.h */; settings = {ATTRIBUTES = (Public, ); }; };
04E212CD222F71E700EC8ED7 /* LLSettingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 04E212CB222F71E700EC8ED7 /* LLSettingView.m */; };
04E212CF222F740600EC8ED7 /* LLPrefixHeader.pch in Headers */ = {isa = PBXBuildFile; fileRef = 04E212CE222F740600EC8ED7 /* LLPrefixHeader.pch */; };
04E212D5222F7B3D00EC8ED7 /* UILabel+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 04E212D1222F7B3D00EC8ED7 /* UILabel+Extension.m */; };
04E212D6222F7B3D00EC8ED7 /* UIButton+Extension.h in Headers */ = {isa = PBXBuildFile; fileRef = 04E212D2222F7B3D00EC8ED7 /* UIButton+Extension.h */; settings = {ATTRIBUTES = (Public, ); }; };
04E212D7222F7B3D00EC8ED7 /* UILabel+Extension.h in Headers */ = {isa = PBXBuildFile; fileRef = 04E212D3222F7B3D00EC8ED7 /* UILabel+Extension.h */; settings = {ATTRIBUTES = (Public, ); }; };
04E212D8222F7B3D00EC8ED7 /* UIButton+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 04E212D4222F7B3D00EC8ED7 /* UIButton+Extension.m */; };
04E212DB222F878D00EC8ED7 /* Macro.h in Headers */ = {isa = PBXBuildFile; fileRef = 04E212DA222F874900EC8ED7 /* Macro.h */; settings = {ATTRIBUTES = (Public, ); }; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
......@@ -36,6 +44,14 @@
042C445221C39536005E1671 /* LLColorView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LLColorView.m; sourceTree = "<group>"; };
044110D821ED6D80006FB01D /* LLCertHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LLCertHelper.h; sourceTree = "<group>"; };
044110D921ED6D80006FB01D /* LLCertHelper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LLCertHelper.m; sourceTree = "<group>"; };
04E212CA222F71E700EC8ED7 /* LLSettingView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LLSettingView.h; sourceTree = "<group>"; };
04E212CB222F71E700EC8ED7 /* LLSettingView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LLSettingView.m; sourceTree = "<group>"; };
04E212CE222F740600EC8ED7 /* LLPrefixHeader.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LLPrefixHeader.pch; sourceTree = "<group>"; };
04E212D1222F7B3D00EC8ED7 /* UILabel+Extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UILabel+Extension.m"; sourceTree = "<group>"; };
04E212D2222F7B3D00EC8ED7 /* UIButton+Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIButton+Extension.h"; sourceTree = "<group>"; };
04E212D3222F7B3D00EC8ED7 /* UILabel+Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UILabel+Extension.h"; sourceTree = "<group>"; };
04E212D4222F7B3D00EC8ED7 /* UIButton+Extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIButton+Extension.m"; sourceTree = "<group>"; };
04E212DA222F874900EC8ED7 /* Macro.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Macro.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
......@@ -69,11 +85,16 @@
042C444821C394DE005E1671 /* LLTool */ = {
isa = PBXGroup;
children = (
04E212D0222F7B3D00EC8ED7 /* Category */,
042C444921C394DE005E1671 /* LLTool.h */,
042C445121C39536005E1671 /* LLColorView.h */,
042C445221C39536005E1671 /* LLColorView.m */,
04E212CA222F71E700EC8ED7 /* LLSettingView.h */,
04E212CB222F71E700EC8ED7 /* LLSettingView.m */,
044110D821ED6D80006FB01D /* LLCertHelper.h */,
044110D921ED6D80006FB01D /* LLCertHelper.m */,
04E212DA222F874900EC8ED7 /* Macro.h */,
04E212CE222F740600EC8ED7 /* LLPrefixHeader.pch */,
042C444A21C394DE005E1671 /* Info.plist */,
);
path = LLTool;
......@@ -86,6 +107,17 @@
name = Frameworks;
sourceTree = "<group>";
};
04E212D0222F7B3D00EC8ED7 /* Category */ = {
isa = PBXGroup;
children = (
04E212D3222F7B3D00EC8ED7 /* UILabel+Extension.h */,
04E212D1222F7B3D00EC8ED7 /* UILabel+Extension.m */,
04E212D2222F7B3D00EC8ED7 /* UIButton+Extension.h */,
04E212D4222F7B3D00EC8ED7 /* UIButton+Extension.m */,
);
path = Category;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
......@@ -94,8 +126,13 @@
buildActionMask = 2147483647;
files = (
042C444B21C394DE005E1671 /* LLTool.h in Headers */,
04E212D6222F7B3D00EC8ED7 /* UIButton+Extension.h in Headers */,
04E212D7222F7B3D00EC8ED7 /* UILabel+Extension.h in Headers */,
04E212CC222F71E700EC8ED7 /* LLSettingView.h in Headers */,
044110DA21ED6D80006FB01D /* LLCertHelper.h in Headers */,
042C445321C39536005E1671 /* LLColorView.h in Headers */,
04E212DB222F878D00EC8ED7 /* Macro.h in Headers */,
04E212CF222F740600EC8ED7 /* LLPrefixHeader.pch in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -190,6 +227,9 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
04E212D8222F7B3D00EC8ED7 /* UIButton+Extension.m in Sources */,
04E212D5222F7B3D00EC8ED7 /* UILabel+Extension.m in Sources */,
04E212CD222F71E700EC8ED7 /* LLSettingView.m in Sources */,
042C445421C39536005E1671 /* LLColorView.m in Sources */,
044110DB21ED6D80006FB01D /* LLCertHelper.m in Sources */,
);
......@@ -324,6 +364,7 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
GCC_PREFIX_HEADER = ./LLTool/LLPrefixHeader.pch;
INFOPLIST_FILE = LLTool/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
......@@ -333,6 +374,7 @@
"@loader_path/Frameworks",
);
MACH_O_TYPE = staticlib;
OTHER_LDFLAGS = "-all_load";
PRODUCT_BUNDLE_IDENTIFIER = com.bairuitech.LLTool;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
......@@ -350,6 +392,7 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
GCC_PREFIX_HEADER = ./LLTool/LLPrefixHeader.pch;
INFOPLIST_FILE = LLTool/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
......@@ -359,6 +402,7 @@
"@loader_path/Frameworks",
);
MACH_O_TYPE = staticlib;
OTHER_LDFLAGS = "-all_load";
PRODUCT_BUNDLE_IDENTIFIER = com.bairuitech.LLTool;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
......
//
// UIButton+Extension.h
// text
//
// Created by 格式化油条 on 15/9/10.
// Copyright (c) 2015年 XQBoy. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIButton (Extension)
/** 创建按钮,设置按钮文字,文字颜色默认灰色,文字大小默认15 */
+ (instancetype)buttonWithTitle:(NSString *)title atTarget:(id)target atAction:(SEL)action;
/** 创建按钮,设置按钮文字与大小,文字颜色默认灰色 */
+ (instancetype)buttonWithTitle:(NSString *)title atTitleSize:(CGFloat)size atTarget:(id)target atAction:(SEL)action;
/** 创建按钮,设置按钮文字与文字颜色,文字大小默认15 */
+ (instancetype)buttonWithTitle:(NSString *)title atTitleColor:(UIColor *)color atTarget:(id)target atAction:(SEL)action;
/** 创建按钮,设置按钮文字、文字颜色与文字大小 */
+ (instancetype)buttonWithTitle:(NSString *)title atTitleSize:(CGFloat)size atTitleColor:(UIColor *)color atTarget:(id)target atAction:(SEL)action;
/** 创建带有图片与文字的按钮,文字颜色默认为灰色 */
+ (instancetype)buttonWithTitle:(NSString *)title atNormalImageName:(NSString *)normalImageName atSelectedImageName:(NSString *)selectedImageName atTarget:(id)target atAction:(SEL)action;
/** 创建带有背景图片与文字的按钮,文字颜色默认为灰色 */
+ (instancetype)buttonWithTitle:(NSString *)title atBackgroundNormalImageName:(NSString *)BackgroundImageName atBackgroundSelectedImageName:(NSString *)BackgroundselectedImageName atTarget:(id)target atAction:(SEL)action;
@end
//
// UIButton+Extension.m
// text
//
// Created by 格式化油条 on 15/9/10.
// Copyright (c) 2015年 XQBoy. All rights reserved.
//
#import "UIButton+Extension.h"
@implementation UIButton (Extension)
/** 创建按钮,设置按钮文字,文字颜色默认灰色,文字大小默认15 */
+ (instancetype)buttonWithTitle:(NSString *)title atTarget:(id)target atAction:(SEL)action {
return [self buttonWithTitle:title atTitleSize:0 atTitleColor:nil atTarget:target atAction:action];
}
/** 创建按钮,设置按钮文字与大小,文字颜色默认灰色 */
+ (instancetype)buttonWithTitle:(NSString *)title atTitleSize:(CGFloat)size atTarget:(id)target atAction:(SEL)action {
return [self buttonWithTitle:title atTitleSize:size atTitleColor:nil atTarget:target atAction:action];
}
/** 创建按钮,设置按钮文字与文字颜色,文字大小默认15 */
+ (instancetype)buttonWithTitle:(NSString *)title atTitleColor:(UIColor *)color atTarget:(id)target atAction:(SEL)action {
return [self buttonWithTitle:title atTitleSize:0 atTitleColor:color atTarget:target atAction:action];
}
/** 创建按钮,设置按钮文字、文字颜色与文字大小 */
+ (instancetype)buttonWithTitle:(NSString *)title atTitleSize:(CGFloat)size atTitleColor:(UIColor *)color atTarget:(id)target atAction:(SEL)action {
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setTitle:title forState:UIControlStateNormal];
[button.titleLabel setFont:[UIFont systemFontOfSize: (size ? : 15 )]];
[button setTitleColor:(color ? : [UIColor grayColor]) forState:UIControlStateNormal];
[button addTarget:target action:action forControlEvents:UIControlEventTouchDown];
return button;
}
/** 创建带有图片与文字的按钮 */
+ (instancetype)buttonWithTitle:(NSString *)title atNormalImageName:(NSString *)normalImageName atSelectedImageName:(NSString *)selectedImageName atTarget:(id)target atAction:(SEL)action {
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setTitle:title forState:UIControlStateNormal];
[button setTitleColor:RGB(192, 192, 192) forState:UIControlStateNormal];
[button setImage:(normalImageName ? [UIImage imageNamed:normalImageName] : nil) forState:UIControlStateNormal];
[button setImage:(selectedImageName ? [UIImage imageNamed:selectedImageName] : nil) forState:UIControlStateSelected];
button.titleEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0);
[button.titleLabel setFont:FONTS(15)];
[button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
return button;
}
/** 创建带有图片与文字的按钮 */
+ (instancetype)buttonWithTitle:(NSString *)title atBackgroundNormalImageName:(NSString *)BackgroundImageName atBackgroundSelectedImageName:(NSString *)BackgroundselectedImageName atTarget:(id)target atAction:(SEL)action {
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
/** 设置标题 */
[button setTitle:title forState:UIControlStateNormal];
/** 设置字体颜色 */
[button setTitleColor:RGB(192, 192, 192) forState:UIControlStateNormal];
/** 普通背景图 */
[button setBackgroundImage:(BackgroundImageName ? [UIImage imageNamed:BackgroundImageName] : nil) forState:UIControlStateNormal];
/** 选中背景图 */
[button setBackgroundImage:(BackgroundselectedImageName ? [UIImage imageNamed:BackgroundselectedImageName] : nil) forState:UIControlStateSelected];
/** 添加点击事件 */
[button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
/** 设置字体 */
[button.titleLabel setFont:FONTS(15)];
return button;
}
@end
//
// UILabel+Extension.h
// text
//
// Created by 格式化油条 on 15/9/10.
// Copyright (c) 2015年 XQBoy. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UILabel (Extension)
/** 创建label,默认文字颜色为灰色,文字大小为15 */
+ (instancetype)labelWithText:(NSString *)text;
/** 创建label,自定义文字颜色,默认文字大小为15 */
+ (instancetype)labelWithText:(NSString *)text atColor:(UIColor *)color;
/** 自定义文字大小与颜色 */
+ (instancetype)labelWithText:(NSString *)text atColor:(UIColor *)color atTextSize:(CGFloat)size;
@end
//
// UILabel+Extension.m
// text
//
// Created by 格式化油条 on 15/9/10.
// Copyright (c) 2015年 XQBoy. All rights reserved.
//
#import "UILabel+Extension.h"
@implementation UILabel (Extension)
/** 创建label,默认文字颜色为灰色,文字大小为14 */
+ (instancetype)labelWithText:(NSString *)text {
return [self labelWithText:text atColor:nil];
}
/** 创建label,自定义文字颜色,默认文字大小为14 */
+ (instancetype)labelWithText:(NSString *)text atColor:(UIColor *)color {
return [self labelWithText:text atColor:color atTextSize:0];
}
/** 自定义文字大小与颜色 */
+ (instancetype)labelWithText:(NSString *)text atColor:(UIColor *)color atTextSize:(CGFloat)size {
UILabel *label = [[self alloc] init];
[label setText:text];
[label setTextColor:color ? : [UIColor blackColor]];
[label setFont:[UIFont systemFontOfSize:size ? : 14]];
return label;
}
@end
//
// LLPrefixHeader.pch
// LLTool
//
// Created by Mac on 2019/3/6.
// Copyright © 2019 BaiRuiTechnology. All rights reserved.
//
#ifndef LLPrefixHeader_pch
#define LLPrefixHeader_pch
#import "UIButton+Extension.h"
#import "UILabel+Extension.h"
#import "Macro.h"
// Include any system framework and library headers here that should be included in all compilation units.
// You will also need to set the Prefix Header build setting of one or more of your targets to reference this file.
#endif /* LLPrefixHeader_pch */
//
// LLSettingView.h
// LLTool
//
// Created by Mac on 2019/3/6.
// Copyright © 2019 BaiRuiTechnology. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger, LLSettingViewTag) {
LLSettingViewTagNone=0, //无
LLSettingViewTag1, //测试1
LLSettingViewTag2, //测试2
LLSettingViewTag3 //测试3
};
@interface LLSettingViewAdapter : NSObject
@property (nonatomic,copy) void(^settingButtonClickBlock)(UIButton *button, int tag);
@end
@interface LLSettingView : UIView
@property (nonatomic, strong) LLSettingViewAdapter *adapter;
@end
NS_ASSUME_NONNULL_END
//
// LLSettingView.m
// LLTool
//
// Created by Mac on 2019/3/6.
// Copyright © 2019 BaiRuiTechnology. All rights reserved.
//
#import "LLSettingView.h"
@implementation LLSettingViewAdapter
@end
@interface LLSettingView()
@property (nonatomic, assign) int style;
@property (nonatomic, strong) NSMutableArray *buttonsArr;
@end
@implementation LLSettingView
- (instancetype)init {
if (self = [super init]) {
[self commonInit];
}
return self;
}
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
[self commonInit];
}
return self;
}
- (id)initWithCoder:(NSCoder *)aDecoder {
if (self = [super initWithCoder:aDecoder]) {
[self commonInit];
}
return self;
}
- (void)commonInit {
self.buttonsArr = [NSMutableArray array];
[self addButtonsRemoveTag:LLSettingViewTagNone];
}
- (void)addButtonsRemoveTag:(int)removeTag
{
for (UIButton *button in self.buttonsArr) {
[button removeFromSuperview];
}
[self.buttonsArr removeAllObjects];
[self addButtonWithTag:LLSettingViewTag1 normalImageName:nil selectedImageName:nil];
[self addButtonWithTag:LLSettingViewTag2 normalImageName:nil selectedImageName:nil];
[self addButtonWithTag:LLSettingViewTag3 normalImageName:nil selectedImageName:nil];
CGRect frame = self.frame;
frame.size.height = self.buttonsArr.count * AC_WIDTH_FIT(44+10) + AC_WIDTH_FIT(10);
self.frame = frame;
}
- (void)addButtonWithTag:(int)tag normalImageName:(NSString *)normalImageName selectedImageName:(NSString *)selectedImageName
{
UIButton *iconBtn = [UIButton buttonWithTitle:@"" atTitleColor:[UIColor whiteColor] atTarget:self atAction:@selector(iconBtnClick:)];
[iconBtn setBackgroundColor:[UIColor blueColor]];
if (normalImageName.length > 0) {
[iconBtn setImage:[UIImage imageNamed:normalImageName] forState:UIControlStateNormal];
}
if (selectedImageName.length > 0) {
[iconBtn setImage:[UIImage imageNamed:selectedImageName] forState:UIControlStateSelected];
}
//>>>>>>test
{
switch (tag) {
case LLSettingViewTag1:
{
[iconBtn setTitle:@"tag1" forState:UIControlStateNormal];
}
break;
case LLSettingViewTag2:
{
[iconBtn setTitle:@"tag2" forState:UIControlStateNormal];
}
break;
case LLSettingViewTag3:
{
[iconBtn setTitle:@"tag3" forState:UIControlStateNormal];
}
break;
default:
break;
}
}
[self addSubview:iconBtn];
iconBtn.tag = tag;
CGFloat y = self.buttonsArr.count * AC_WIDTH_FIT(44+10);
iconBtn.frame = CGRectMake(0, y, AC_WIDTH_FIT(44), AC_WIDTH_FIT(44));
[self.buttonsArr addObject:iconBtn];
}
- (void)iconBtnClick:(UIButton *)sender {
int tag = (int)sender.tag;
if (self.adapter.settingButtonClickBlock) {
self.adapter.settingButtonClickBlock(sender, tag);
}
// switch (style) {
// case LLSettingViewStyleAudio:
// case LLSettingViewStyleSingle:
// case LLSettingViewStyleDouble:
// {
// if ([self isRecording]) {
// return;
// }
// [self addButtonsRemoveStyle:style];
// }
// break;
//
// default:
// break;
// }
}
@end
......@@ -20,3 +20,7 @@ FOUNDATION_EXPORT const unsigned char LLToolVersionString[];
//#import <AnyChatSDK/AnyChatInitOpt.h>
//#import "AnyChatSDK.h"
#import "LLCertHelper.h"
#import "LLSettingView.h"
#import "UIButton+Extension.h"
#import "UILabel+Extension.h"
#import "Macro.h"
//
// Macro.h
// LLTool
//
// Created by Mac on 2019/3/6.
// Copyright © 2019 BaiRuiTechnology. All rights reserved.
//
#ifndef Macro_h
#define Macro_h
//获取屏幕 宽度、高度
#define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)
#define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)
#define WS(weakSelf) __weak __typeof(&*self)weakSelf = self
#define FONTS(size) [UIFont systemFontOfSize:(size)]
// 获取RGB颜色
#define RGBA(r,g,b,a) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]
#define RGB(r,g,b) RGBA(r,g,b,1.0f)
// rgb颜色转换(16进制->10进制)
#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define UIColorFromRGBA(rgbValue,a) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0f green:((float)((rgbValue & 0xFF00) >> 8))/255.0f blue:((float)(rgbValue & 0xFF))/255.0f alpha:a]
#define NavBar_StatusBar_Height [UIApplication sharedApplication].statusBarFrame.size.height
#define NavBar_Height (NavBar_StatusBar_Height + 44.0) //状态栏高度+导航栏
#define AC_PLUS_HEIGHT 736.0
#define AC_PLUS_WIDTH 414.0
#define AC_WIDTH_FIT(width) (((width)/AC_PLUS_WIDTH)*SCREEN_WIDTH)
#endif /* Macro_h */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册