IOS 开发学习十六 UIActionSheet的使用
2015-05-20 10:14
495 查看
1.修改头文件,
2.事件:
3.委托获取点击
@interface WasherFunsContentViewController : UIViewController<UIActionSheetDelegate>{ }
2.事件:
- (IBAction)showSheet:(id)sender { UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"title,nil时不显示" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:@"确定" otherButtonTitles:@"第一项", @"第二项",nil]; actionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque;//黑底白字 // UIActionSheetStyleBlackTranslucent透明底白字 // UIActionSheetStyleDefault 灰底白字 [actionSheet showInView:self.view]; //使用Toolbar时,代码像下面这样写 //[actionSheet showInView:[UIApplication sharedApplication].keyWindow]; //[sheet showInView:[AppDelegate sharedDelegate].tabBarController.view] }
3.委托获取点击
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { if (buttonIndex == 0) { NSLog(@"确定"); }else if (buttonIndex == 1) { NSLog(@"第一项"); }else if(buttonIndex == 2) { NSLog(@"第二项"); }else if(buttonIndex == 3) { NSLog(@"取消"); } } - (void)actionSheetCancel:(UIActionSheet *)actionSheet{ NSLog(@"cancel"); } -(void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex{ NSLog(@"didDismiss"); } -(void)actionSheet:(UIActionSheet *)actionSheet willDismissWithButtonIndex:(NSInteger)buttonIndex{ NSLog(@"willDismiss"); }
相关文章推荐
- IOS学习之UIActionSheet的使用
- IOS学习之UIActionSheet的使用
- IOS学习4 UIActionSheet的使用
- iOS学习之UIActionSheet的使用
- IOS学习——UIActionSheet的使用
- iOS学习之UIActionSheet的使用
- iOS学习之UIActionSheet的使用
- IOS开发学习笔记(十六)——使用地理位置及地图(上篇)
- iOS学习之UIActionSheet的使用
- iOS学习之UIActionSheet的使用
- IOS 学习之UIActionSheet的使用
- IOS学习笔记(九)之UIAlertView(警告视图)和UIActionSheet(操作表视图)基本概念和使用方法
- IOS学习笔记(九)之UIAlertView(警告视图)和UIActionSheet(操作表视图)基本概念和使用方法
- iOS学习之UIActionSheet的使用
- iOS学习笔记—— UIAlertView 和 UIActionSheet 的使用
- iOS学习之UIActionSheet的使用
- iOS学习之UIActionSheet的使用
- iOS学习之UIActionSheet的使用
- iOS学习之UIActionSheet的使用
- 学习IOS开发UI篇--UIAlertView/UIActionSheet