[IOS]UIActionSheet的使用

[IOS]UIActionSheet的使用 



[IOS]UIActionSheet的使用

Demo地址:http://download.csdn.net/detail/u012881779/8475177

默认样式:

[objc]  view plain  copy
 print ? 在CODE上查看代码片 派生到我的代码片
  1. #import "ASViewController.h"  
  2.   
  3. @interface ASViewController ()<UIActionSheetDelegate>  
  4.   
  5. @end  
  6.   
  7. @implementation ASViewController  
  8.   
  9. //分享按钮  
  10. - (IBAction)tapButtonAction:(id)sender {  
  11.       
  12.     UIActionSheet *actionSheet=[[UIActionSheet alloc] initWithTitle:nil  
  13.                                                            delegate:self  
  14.                                                   cancelButtonTitle:@"关闭"  
  15.                                              destructiveButtonTitle:nil  
  16.                                                   otherButtonTitles:@"分享到新浪微博",@"分享到微信好友",@"分享到朋友圈", nil nil];  
  17.     actionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque;  
  18.     [actionSheet showInView:self.view];  
  19. }  
  20.   
  21. -(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{  
  22.       
  23.     switch (buttonIndex) {  
  24.         case 0:  
  25.             [self shareToAction:@"SINA"];  
  26.             break;  
  27.               
  28.         case 1:  
  29.             [self shareToAction:@"WEIXIN"];  
  30.             break;  
  31.               
  32.         case 2:  
  33.             [self shareToAction:@"PENGYOU"];  
  34.             break;  
  35.               
  36.         default:  
  37.             break;  
  38.     }  
  39. }  
  40.   
  41. -(void)shareToAction:(NSString *)sender{  
  42.     NSLog(@"%@",sender);  
  43. }  

1.默认样式


2.自定义样式一


3.自定义样式二



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值