您的位置:首页 > 移动开发 > IOS开发

一个自定义的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

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息