Skip to content

xq-120/XQSheet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

XQSheet

A convenient sheet presented from bottom.

开发这个控件,主要是因为系统的UIActionSheet在iOS8已经被废弃了,而UIAlertController在自定义颜色,字体方面不是很方便,而且UIAlertController需要iOS8及以上系统,考虑到还需要适配iOS7.所以就做了这么一个控件.通过工厂方法传入不同的参数可以实例化多种样式的菜单.

按钮的顺序与你添加的顺序一致.

功能

自定义"菜单"上的文字颜色,文字字体大小等更加方便.采用block回调的方式配置按钮及执行按钮事件,让代码更加紧凑.适配iPhoneX.

集成

pod 'XQSheet'

使用

//通过工厂方法实例化对象, XQSheetTypeSelect/XQSheetTypeAction两种
XQSheet *sheet = [XQSheet sheetWithType:XQSheetTypeSelect title:nil subTitle:nil cancelButtonTitle:nil];
sheet.selectedBtnMarkImage = [UIImage imageNamed:@"fb_btn_selected"];
[sheet addBtnWithTitle:@"先不冲" configHandler:nil actionHandler:^(UIButton *button, NSString *buttonTitle, NSInteger buttonIndex) {
    UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"提示" message:[NSString stringWithFormat:@"你选择了:%@", buttonTitle] delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil];
    [av show];
}];
[sheet addBtnWithTitle:@"冲满" configHandler:nil actionHandler:^(UIButton *button, NSString *buttonTitle, NSInteger buttonIndex) {
    UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"提示" message:[NSString stringWithFormat:@"你选择了:%@", buttonTitle] delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil];
    [av show];
}];
[sheet addBtnWithTitle:@"别烦我" configHandler:nil actionHandler:^(UIButton *button, NSString *buttonTitle, NSInteger buttonIndex) {
    UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"提示" message:[NSString stringWithFormat:@"你选择了:%@", buttonTitle] delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil];
    [av show];
}];
sheet.selectedIndex = 1;
[sheet showSheetWithController:self completion:nil];

效果

样式1

Drawing

样式2

Drawing

样式3

Drawing

样式4

Drawing

样式5

Drawing

注意事项

该控件暂不支持横屏.使用过程中有任何bug,可以告诉我.

About

一个从底部弹出菜单选项的控件.

Resources

License

Stars

Watchers

Forks

Packages

No packages published