支持Block和Delegate的方式回调点击位置。
- 具体使用方法:Block
- 导入头文件 #import "XJActionSheet.h"
- 创建XJActionSheet
XJActionSheet *actionSheet = [XJActionSheet actionSheetWithTitle:<#(NSString *)#> confirms:<#(NSArray *)> cancel:<#(NSString *)#> style:<#(XJActionSheetStyle)#> click:^(NSInteger index) { <#code#> }];
- 展示到window上
[actionSheet showInView:self.view.window];
- 具体使用方法:Delegate
- 导入头文件 #import "XJActionSheet.h"
- 加入协议
<XJActionSheetDelegate>
- 创建XJActionSheet并设置代理为self
XJActionSheet *actionSheet = [XJActionSheet actionSheetWithTitle:<#(NSString *)#> confirms:<#(NSArray *)#> cancel:<#(NSString *)#> style:<#(XJActionSheetStyle)#>]; actionSheet.delegate = self; [actionSheet showInView:self.view.window];
-
#pragma mark - XJActionSheetDelegate
- (void)clickAction:(XJActionSheet *)actionSheet atIndex:(NSUInteger)index { NSLog(@"选中了 %ld",index); }
实现选中的事件