HcdActionSheet
一个类似微信的自定义 ActionSheet。
要求
- Xcode 6 或更高版本
- iOS 7.0 或更高版本
- ARC
安装
手动安装
您需要做的事情就是将 HcdActionSheet
文件拖入您的项目中,并将 #include "HcdActionSheet.h"
添加到使用它的类顶部。
Cocoapods
切换到您的Xcode项目目录
$ cd /path/to/YourProject
$ touch Podfile
$ edit Podfile
编辑Podfile并添加HcdActionSheet
pod 'HcdActionSheet'
安装到您的Xcode项目
$ pod install
使用.xcworkspace文件从Xcode中打开项目(不是常规的项目文件)
$ open YourProject.xcworkspace
示例
HcdActionSheet *sheet = [[HcdActionSheet alloc] initWithCancelStr:@"Cancle"
otherButtonTitles:@[@"Log Out"]
attachTitle:@"Are you sure Log Out?"];
sheet.selectButtonAtIndex = ^(NSInteger index) {
NSLog(@"%ld", (long)index);
};
[[UIApplication sharedApplication].keyWindow addSubview:sheet];
[sheet showHcdActionSheet];
您可以在需要显示HcdActionSheet的ViewController中写入此代码。