用法和系统的ActionSheet一样简单,没有依赖其他框架。
可以让ios6拥有ios8的风格的ActionSheet
// 1.创建HJCActionSheet对象, 可以随意设置标题个数,第一个为取消按钮的标题,需要设置代理才能监听点击结果
HJCActionSheet *sheet = [[HJCActionSheet alloc] initWithDelegate:self CancelTitle:@"取消" OtherTitles:@"哈哈", @"嘿嘿", @"哄哄", nil];
// 2.显示出来
[sheet show];
// 3.实现代理方法,需要遵守HJCActionSheetDelegate代理协议
- (void)actionSheet:(HJCActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
switch (buttonIndex) {
case 1:
_testLabel.text = @"哈哈";
break;
case 2:
_testLabel.text = @"嘿嘿";
break;
case 3:
_testLabel.text = @"哄哄";
break;
}
}
测试环境:Xcode 6.2,iOS 6.0以上