支持Block和Delegate的方式回調(diào)點擊位置吗伤。
- 具體使用方法:Block
- 導(dǎo)入頭文件 #import "XJActionSheet.h"
- 創(chuàng)建XJActionSheet
XJActionSheet *actionSheet = [XJActionSheet actionSheetWithTitle:<#(NSString *)#> confirms:<#(NSArray *)> cancel:<#(NSString *)#> style:<#(XJActionSheetStyle)#> click:^(NSInteger index) { <#code#> }];
- 展示到window上
[actionSheet showInView:self.view.window];
- 具體使用方法:Delegate
- 導(dǎo)入頭文件 #import "XJActionSheet.h"
- 加入?yún)f(xié)議
<XJActionSheetDelegate>
- 創(chuàng)建XJActionSheet并設(shè)置代理為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); }
實現(xiàn)選中的事件