UIActionSheet操作表单
来源:互联网 发布:matlab的分块矩阵运算 编辑:程序博客网 时间:2024/05/22 11:51
一、定义ActionSheet:
UIActionSheet* mySheet = [[UIActionSheet alloc] initWithTitle:@"ActionChoose"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:@"Destroy"
otherButtonTitles:@"OK", nil];
[mySheet showInView:self.view];
二、与UIAlertView类似,我们也是在委托方法里处理按下按钮后的动作。记得在所委托的类加上UIActionSheetDelegate。
- (void)actionSheetCancel:(UIActionSheet *)actionSheet{ }
- (void) actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{ }
-(void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex{ }
-(void)actionSheet:(UIActionSheet *)actionSheet willDismissWithButtonIndex:(NSInteger)buttonIndex{ }
三、ActionSheet支持的一种所谓的销毁按钮,对某户的某个动作起到警示作用,比如永久性删除一条消息或者日志。如果你指定了一个销毁按钮他就会以红色高亮显示:
mySheet.destructiveButtonIndex=1;
四、与导航栏类似,操作表单也支持三种风格 :
UIActionSheetStyleDefault //默认风格:灰色背景上显示白色文字
UIActionSheetStyleBlackTranslucent //透明黑色背景,白色文字
UIActionSheetStyleBlackOpaque //纯黑背景,白色文字
用法:mySheet.actionSheetStyle = UIActionSheetStyleBlackOpaque;
五、显示ActionSheet有三种方法:
1.在一个视图内部显示,可以用showInView
[mySheet showInView:self];
2.如果要将ActonSheet 与工具栏或者标签栏对齐,可以使用showFromToolBar或showFromTabBar
[mySheet showFromToolBar:toolbar];
[mySheet showFromTabBar:tabbar];
六、解除操作表单
用户按下按钮之后,Actionsheet就会消失——除非应用程序有特殊原因,需要用户按下做个按钮。用dismiss方法可令表单消失:
[mySheet dismissWithClickButtonIndex:1 animated:YES];- UIActionSheet操作表单
- UIActionSheet操作表单-IOS开发
- UIActionSheet/表单视图
- UIActionSheet 操作表
- iphone 弹出表单UIActionSheet的应用。
- UIActionSheet
- UIActionSheet
- UIActionSheet
- UIActionSheet
- UIActionSheet
- UIActionSheet
- UIActionSheet
- UIActionSheet
- UIActionSheet
- UIActionSheet
- UIActionSheet
- UIActionSheet
- UIActionSheet
- 前端工程师面试问题
- 不知起什么名字好……
- extundelete usage
- xcode 出现libxml/tree.h编译错误解决办法
- 杂记之C语言实现C++函数strstr
- UIActionSheet操作表单
- C#域验证的代码
- Multisampling in Direct3D
- BibTeX的使用
- JAVA_EE架构师_需要具备的知识
- 分割矩阵 (二分范围[L,R))
- 操纵状态栏
- 编写高效C语言的四大绝招
- ANDROID 视频播放代码