Latest 1.0.6
Homepage https://github.com/xq-120/XQSheet
License MIT
Platforms ios 7.0, requires ARC
Frameworks Foundation, UIKit
Authors

A convenient sheet presented from bottom.

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

按钮的顺序与你添加的顺序一致,对于XQSheetTypeAction默认带有取消按钮.

功能

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

使用

    //通过工厂方法实例化对象, 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 showSheet];

效果

样式1

Drawing

样式2

Drawing

样式3

Drawing

样式4

Drawing

样式5

Drawing

注意事项

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

Latest podspec

{
    "name": "XQSheet",
    "version": "1.0.6",
    "summary": "A convenient sheet presented from bottom.",
    "description": "A convenient sheet presented from bottom, which implement by Objective-C.",
    "homepage": "https://github.com/xq-120/XQSheet",
    "license": "MIT",
    "authors": {
        "xq-120": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/xq-120/XQSheet.git",
        "tag": "1.0.6"
    },
    "source_files": "XQSheet/*",
    "frameworks": [
        "Foundation",
        "UIKit"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This