进击的UI--------------UIActionSheet(提示)

// UIActionSheet这个控件很常用,和UIAlertView类似,先附图
// 添加了过多的选项,就会以列表的形式显示
 
// 正常显示
 
// 下面直接上代码
// 注意,需要在头文件中实现UIActionSheetDelegate协议
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"请选择你喜欢的水果"                                                      delegate:self                                                      cancelButtonTitle:@"取消"
destructiveButtonTitle:@"确定" // 这个按钮的会以红色显示,在次设置一些重要的选项                                                    otherButtonTitles:@"苹果", @"葡萄", @"大枣儿", @"哈密瓜", @"杏儿", @"荔枝", nil];
actionSheet.delegate = self; // 设置代理为本身actionSheet.actionSheetStyle = UIActionSheetStyleAutomatic; // 设置样式  
[actionSheet showInView:self.view]; // 设置UIAcitonSheet在哪个view上显示
[actionSheet release], actionSheet = nil;
// 代理方法
#pragma mark - 重写-----UIActionSheetDelegate协议中的方法
#pragma mark 判断您点击的是哪个按钮
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
    NSLog(@"点击了序号为 %d 的按钮", buttonIndex);
}
#pragma mark 将要隐藏
- (void)actionSheet:(UIActionSheet *)actionSheet willDismissWithButtonIndex:(NSInteger)buttonIndex {
NSLog(@"点击序号为 %d 的按钮  <<span style="line-height: normal; font-family: 'Heiti SC Light'; ">将要>  使UIActionSheet隐藏", buttonIndex);
}
#pragma mark 已经隐藏
- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex {
NSLog(@"点击序号为 %d 的按钮  <<span style="line-height: normal; font-family: 'Heiti SC Light'; ">已经>  使UIActionSheet隐藏", buttonIndex);}
#pragma mark 不明白这个方法,希望懂的告诉下
- (void)actionSheetCancel:(UIActionSheet *)actionSheet {
}
 

转载于:https://www.cnblogs.com/sharkHZ/p/4984176.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值