Objective-C-iOS常用小控件(UIActionSheet )动作列表
2016-09-22 09:07
302 查看
//UIActionSheet 动作列表
- (void)createActionSheet{
//创建列表
UIActionSheet *actionSheet = [[UIActionSheet
alloc]initWithTitle:@"请选择联系方式"
delegate:self
cancelButtonTitle:@"取消"
destructiveButtonTitle:nil
otherButtonTitles:@"打电话",@"发邮件",@"发短信",
nil];
//显示
//设置代理
// actionSheet.delegate = self;
//设置title
// actionSheet.title = @"请选择";
//设置放风格
actionSheet.actionSheetStyle =
UIActionSheetStyleDefault;//默认风格,灰色背景,白色文字
actionSheet.actionSheetStyle =
UIActionSheetStyleAutomatic;//自动
actionSheet.actionSheetStyle =
UIActionSheetStyleBlackOpaque;//透明黑色背景,白色文字
actionSheet.actionSheetStyle =
UIActionSheetStyleBlackTranslucent;//纯黑背景,白色文字
//添加按钮
[actionSheet addButtonWithTitle:@"京津追梦人"];
//总的按钮数
NSInteger nums = actionSheet.numberOfButtons;
//取消按钮的下标
NSInteger cancelIndex = actionSheet.cancelButtonIndex;
//点击取消按钮让表消失
//- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated;
[actionSheet showInView:self.view];
}
//代理方法
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
//可以知道点击了第几项。
NSLog(@"点击了第%zd个按钮",buttonIndex);
}
- (void)createActionSheet{
//创建列表
UIActionSheet *actionSheet = [[UIActionSheet
alloc]initWithTitle:@"请选择联系方式"
delegate:self
cancelButtonTitle:@"取消"
destructiveButtonTitle:nil
otherButtonTitles:@"打电话",@"发邮件",@"发短信",
nil];
//显示
//设置代理
// actionSheet.delegate = self;
//设置title
// actionSheet.title = @"请选择";
//设置放风格
actionSheet.actionSheetStyle =
UIActionSheetStyleDefault;//默认风格,灰色背景,白色文字
actionSheet.actionSheetStyle =
UIActionSheetStyleAutomatic;//自动
actionSheet.actionSheetStyle =
UIActionSheetStyleBlackOpaque;//透明黑色背景,白色文字
actionSheet.actionSheetStyle =
UIActionSheetStyleBlackTranslucent;//纯黑背景,白色文字
//添加按钮
[actionSheet addButtonWithTitle:@"京津追梦人"];
//总的按钮数
NSInteger nums = actionSheet.numberOfButtons;
//取消按钮的下标
NSInteger cancelIndex = actionSheet.cancelButtonIndex;
//点击取消按钮让表消失
//- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated;
[actionSheet showInView:self.view];
}
//代理方法
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
//可以知道点击了第几项。
NSLog(@"点击了第%zd个按钮",buttonIndex);
}
相关文章推荐
- Swift-iOS常用控件(UIActionSheet 动作列表)
- Objective-C-iOS常用小控件(UIAlertView)警告框
- Objective-C-iOS常用小控件(UISwitch)
- ios-UIAlertView,UIActionSheet-常用方法
- Objective-C-iOS常用小控件(UIActivityIndicatorView)
- Objective-C-iOS常用小控件(UIStepper)计数器/步进器
- Objective-C-iOS常用小控件(UISlider)
- Objective-C-iOS常用小控件(UISegmentedControl)
- Objective-C-iOS常用小控件(UIProcessView)进度条
- [iOS] iPhone常用控件、UIActionSheet、UIAlertView
- iOS中的表单按钮选项UIActionSheet常用方法整理
- IOS之UIActionSheet& UIAlertView
- iOS UIAlertController 弹框 (ios 9.0 后代替了UIAlertView弹框 和 UIActionSheet下弹框)
- 【代码笔记】iOS-UIActionSheet动态添加按钮
- 【代码笔记】iOS-清除图片缓存UIActionSheet
- iOS(iPhone,iPad))开发(Objective-C)开发库常用库索引
- IOS开发问题解决之UIAlertView调用UIActionSheet后灰色背景一直存在
- React Native-15.React Native 常用API及实践 AlertIOS AlertSheetIOS
- 【深入浅出ios开发】UIActionSheet
- iOS开发(Objective-C)常用库索引