首页 > 其他 > 详细

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

时间:2015-11-21 18:11:01      阅读:206      评论:0      收藏:0      [点我收藏+]
// 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 {
}
 

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

原文:http://www.cnblogs.com/sharkHZ/p/4984176.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!