一个自定义的ActionSheet,可以自已轻松修改上面的东西
2016-03-31 11:32
627 查看
一两年前,为了配合公司的产品看到系统的ActionSheet样式那样,就瞎BB,说什么也要按照他设计的那样做。于是本宝宝就乱七八糟瞎搞了一个给他。最近感觉系统的ActionSheet确实比较局限,于是自写一个。
用法
XJLActionSheet *xjlActionSheet = [[XJLActionSheet alloc] initWithDelegate:self title:@"这个是标题" cancelButton:@"取消" otherTitle:@"确定",@"第一个", @"第二个", nil];
[xjlActionSheet show];
里面的东西可以自己改
#define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height
#define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width
#define labelFont [UIFont systemFontOfSize:18] // 文本的字体
#define labelTextColor [UIColor blackColor] // 文本的字体颜色
#define labelHeight 50 // 每个按钮的高度
#define titleFont [UIFont boldSystemFontOfSize:18] // 标题字体大小
#define titleTextColor [UIColor redColor] // 标题颜色
#define LastButtonDistans 10 // 与最后一个按钮的距离
代理
MyActionSheetDelegate
代理方法
- (void)myActionSheet:(XJLActionSheet *)actionSheet parentView:(UIView *)parentView subLabel:(UILabel *)subLabel
index:(NSInteger)index;
里面的view都可以在外面拿到。想在上面加什么,就加在parentView上面就可以了
代码已放到https://github.com/xingxinglao/LJXActionSheet
用法
XJLActionSheet *xjlActionSheet = [[XJLActionSheet alloc] initWithDelegate:self title:@"这个是标题" cancelButton:@"取消" otherTitle:@"确定",@"第一个", @"第二个", nil];
[xjlActionSheet show];
里面的东西可以自己改
#define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height
#define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width
#define labelFont [UIFont systemFontOfSize:18] // 文本的字体
#define labelTextColor [UIColor blackColor] // 文本的字体颜色
#define labelHeight 50 // 每个按钮的高度
#define titleFont [UIFont boldSystemFontOfSize:18] // 标题字体大小
#define titleTextColor [UIColor redColor] // 标题颜色
#define LastButtonDistans 10 // 与最后一个按钮的距离
代理
MyActionSheetDelegate
代理方法
- (void)myActionSheet:(XJLActionSheet *)actionSheet parentView:(UIView *)parentView subLabel:(UILabel *)subLabel
index:(NSInteger)index;
里面的view都可以在外面拿到。想在上面加什么,就加在parentView上面就可以了
代码已放到https://github.com/xingxinglao/LJXActionSheet
相关文章推荐
- iOS应用程序的生命周期
- 10大iOS开发者最喜爱的类库
- ios线程的五种使用方式
- CocoaPods的安装使用和常见问题
- 如何使用iOS 开发证书 和 Profile 文件
- iOS 正则表达式(身份证号详细验证和粗略验证两种表示,后期会持续添加)
- ionic集成极光推送插件-iOS
- ios监听静音键和音量键事件
- iOS开发之打电话,发短信,发送邮件
- iOS下JS与原生OC互相调用
- iOS开发-环信单聊实现
- iOS - 自定义启动图
- iOS字符截取(表情汉字)
- 屏幕翻转
- iOS打包pod spec
- iOS Xcode工程目录的 folder 和 group的区别(蓝色和黄色文件夹的区别)
- iOS:按钮连续点击 按钮快速点击 如何处理
- ios开发的编码规范
- NSDictionary 总结 -iOS
- IOS开发之Autolayout——“Content Compression Resistance”和“Content Hugging”