1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| #import "ViewController.h"
@interface ViewController ()<UIActionSheetDelegate>
@end
@implementation ViewController
- (void)viewDidLoad { [super viewDidLoad]; }
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
UIActionSheet *sheet = [[UIActionSheet alloc]initWithTitle:@"分享" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:@"删除" otherButtonTitles:@"微博分享",@"微信分享",@"QQ分享", nil];
[sheet showInView:self.view]; } -(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
switch (buttonIndex) { case 0: NSLog(@"%ld",buttonIndex); break; case 1: NSLog(@"%ld",buttonIndex); break; case 2: NSLog(@"%ld",buttonIndex); break; case 3: NSLog(@"%ld",buttonIndex); break; case 4: NSLog(@"%ld",buttonIndex); break; default: break; } } @end
|