Latest 1.3.1
Homepage https://github.com/coderapple/ZHActionSheet
License MIT
Platforms ios 8.0, requires ARC
Frameworks UIKit
Authors

默认样式、系统样式的ActionSheet,可以自定义;支持屏幕旋转。

支持cocoapods导入

pod 'ZHActionSheet'

系统样式

示例图片

system

示例代码

ZHActionSheet *actionSheet = [[ZHActionSheet alloc] initActionSheetWithTitle:@"ActionSheet" contents:@[@"一",@"二",@"三",@"四",@"五"] cancels:@[@"取消",@"删除"]];
actionSheet.actionSheetType = ActionSheetTypeSystem;
actionSheet.subtitle = @"System Type";
[actionSheet addContent:@"〇" atIndex:0];
[actionSheet addContent:@"六" atIndex:6];
[actionSheet removeContentAtIndex:0];
[actionSheet setClickedContent:^(ZHActionSheet *actionSheet, NSUInteger index) {
    NSLog(@"==========ZHActionSheet click at index %ld", index);
}];
[actionSheet show];

默认样式

示例图片

default

示例代码

ZHActionSheet *actionSheet = [[ZHActionSheet alloc] initActionSheetWithTitle:@"ActionSheet" contents:@[@"一",@"二",@"三",@"四",@"五"] cancels:@[@"取消",@"删除"]];
actionSheet.actionSheetType = ActionSheetTypeDefault;
actionSheet.subtitle = @"Default Type";
[actionSheet addContent:@"〇" atIndex:0];
[actionSheet addContent:@"六" atIndex:6];
[actionSheet setCancelAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:20],NSForegroundColorAttributeName:[UIColor purpleColor]} atIndex:0];
[actionSheet setCancelAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:20],NSForegroundColorAttributeName:[UIColor redColor]} atIndex:1];
[actionSheet setClickedContent:^(ZHActionSheet *actionSheet, NSUInteger index) {
    NSLog(@"==========ZHActionSheet click content at index %ld", index);
}];
actionSheet.clickedCancle = ^(ZHActionSheet *actionSheet, NSUInteger index) {
    NSLog(@"==========ZHActionSheet click cancel at index %ld", index);
};
[actionSheet show];

自定义样式

示例图片

1.竖屏

custi=om

2.横屏

custi=om

示例代码

ZHActionSheet *actionSheet = [ZHActionSheet actionSheetWithTitle:nil contents:self.dataSource cancels:nil];
actionSheet.actionSheetType = ActionSheetTypeCustom;
//actionSheet.dataSource = self;
actionSheet.delegate = self;
actionSheet.itemNib = [UINib nibWithNibName:@"ActionSheetItemCell" bundle:nil];
actionSheet.itemHeight = 60;
actionSheet.itemForActionSheet = ^UITableViewCell *(ZHActionSheet *actionSheet, UITableView *tableView, NSString *identifier, NSIndexPath *indexPath) {
    ActionSheetItemCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier forIndexPath:indexPath];
    cell.image.image = [UIImage imageNamed:self.dataSource[indexPath.row]];
    cell.label.text = self.dataSource[indexPath.row];
    return cell;
};
[actionSheet show];
//代理
- (void)actionSheet:(ZHActionSheet *)actionSheet clickedContentAtIndex:(NSUInteger)index {
    NSLog(@"==========ZHActionSheet click content %@ at index %ld", self.dataSource[index], index);
}

Latest podspec

{
    "name": "ZHActionSheet",
    "version": "1.3.1",
    "summary": "ActionSheet",
    "description": "u9ed8u8ba4u6837u5f0fu3001u7cfbu7edfu6837u5f0fuff0cu540cu65f6u53efu4ee5u81eau5b9au4e49uff1bu652fu6301u5c4fu5e55u65cbu8f6cu3002",
    "homepage": "https://github.com/coderapple/ZHActionSheet",
    "screenshots": [
        "https://github.com/coderapple/ZHActionSheet/blob/master/ZHActionSheet/system.PNG",
        "https://github.com/coderapple/ZHActionSheet/blob/master/ZHActionSheet/default.PNG",
        "https://github.com/coderapple/ZHActionSheet/blob/master/ZHActionSheet/custom.PNG"
    ],
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "coderapple": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/coderapple/ZHActionSheet.git",
        "tag": "1.3.1"
    },
    "source_files": "Pod/Classes/*.{h,m}",
    "frameworks": "UIKit",
    "requires_arc": true
}

Pin It on Pinterest

Share This