IOS笔记 - UIActionSheet
来源:互联网 发布:淘宝二手靠谱吗 编辑:程序博客网 时间:2024/06/06 06:14
UIActionSheet *actionSheet = [[UIActionSheet alloc]// initWithTitle:是显示的标题,显示在操作表的顶部。initWithTitle:@"Are you sure?"// delegate:是操作表的委托,将在该表上的按钮被按下时收到通知,// 更确切地说,委托的ActionSheet:didDismissWithButtonIndex:// actionSheet:didDismisswithButtonIndex:方法将被调用。delegate:self// cancelButtonTitle:是取消按钮的标题,用户可以通过点击此按钮表明不希望继续操作。cancelButtonTitle:@"No way!"// destructiveButtonTitle:确定按钮的标题,同上相反。destructiveButtonTitle:@"Yes,I'm sure!"/ otherButtonTitle:是用于指定希望在表单上现实的其他按钮的数量,该参数可以使用各种值// otherButtonTitle:@"Foo",@"Bar",nil];otherButtonTitles:nil];[actionSheet showInView:self.view];[actionSheet release];
关于delegate,
-(void) actionSheet:(UIActionSheet *) actionSheet didDismissWithButtonIndex:(NSInteger) buttonIndex{NSLog(@"buttonIndex is %d",buttonIndex);if (buttonIndex != [actionSheet cancelButtonIndex]) {NSString *msg = nil ;if (nameField.text.length) {msg = [[NSString alloc]initWithFormat: @"You can breathe easy, %@, everything went OK.",nameField.text];} else {msg = @"You can breathe easy,everything went OK.";}UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Something was done" message:msg delegate:self cancelButtonTitle:@"Phew!" otherButtonTitles:nil];[alert show];[alert release];[msg release];}}
Tasks
Responding to Actions
– actionSheet:clickedButtonAtIndex:
Customizing Behavior
– willPresentActionSheet:
– didPresentActionSheet:
– actionSheet:willDismissWithButtonIndex:
– actionSheet:didDismissWithButtonIndex:
Canceling
– actionSheetCancel:
Instance Methods
actionSheet:clickedButtonAtIndex:
Sent to the delegate when the user clicks a button on an action sheet.
Parameters
- actionSheet
The action sheet containing the button.
- buttonIndex
The position of the clicked button. The button indices start at
0
.
Discussion
The receiver is automatically dismissed after this method is invoked.
Availability
- Available in iOS 2.0 and later.
Declared In
UIActionSheet.h
actionSheet:didDismissWithButtonIndex:
Sent to the delegate after an action sheet is dismissed from the screen.
Parameters
- actionSheet
The action sheet that was dismissed.
- buttonIndex
The index of the button that was clicked. The button indices start at
0
. If this is the cancel button index, the action sheet is canceling. If-1
, the cancel button index is not set.
Discussion
This method is invoked after the animation ends and the view is hidden.
Availability
- Available in iOS 2.0 and later.
See Also
– actionSheet:willDismissWithButtonIndex:
Declared In
UIActionSheet.h
actionSheet:willDismissWithButtonIndex:
Sent to the delegate before an action sheet is dismissed.
Parameters
- actionSheet
The action sheet that is about to be dismissed.
- buttonIndex
The index of the button that was clicked. If this is the cancel button index, the action sheet is canceling. If
-1
, the cancel button index is not set.
Discussion
This method is invoked before the animation begins and the view is hidden.
Availability
- Available in iOS 2.0 and later.
See Also
– actionSheet:didDismissWithButtonIndex:
Declared In
UIActionSheet.h
actionSheetCancel:
Sent to the delegate before an action sheet is canceled.
Parameters
- actionSheet
The action sheet that will be canceled.
Discussion
If the action sheet’s delegate does not implement this method, clicking the cancel button is simulated and the action sheet is dismissed. Implement this method if you need to perform some actions before an action sheet is canceled. An action sheet can be canceled at any time by the system—for example, when the user taps the Home button. TheactionSheet:willDismissWithButtonIndex:
and actionSheet:didDismissWithButtonIndex:
methods are invoked after this method.
Availability
- Available in iOS 2.0 and later.
Declared In
UIActionSheet.h
didPresentActionSheet:
Sent to the delegate after an action sheet is presented to the user.
Parameters
- actionSheet
The action sheet that was displayed.
Availability
- Available in iOS 2.0 and later.
See Also
– willPresentActionSheet:
Declared In
UIActionSheet.h
willPresentActionSheet:
Sent to the delegate before an action sheet is presented to the user.
Parameters
- actionSheet
The action sheet that is about to be displayed.
Availability
- Available in iOS 2.0 and later.
See Also
– didPresentActionSheet:
Declared In
UIActionSheet.h
Tasks
Responding to Actions
– actionSheet:clickedButtonAtIndex:
Customizing Behavior
– willPresentActionSheet:
– didPresentActionSheet:
– actionSheet:willDismissWithButtonIndex:
– actionSheet:didDismissWithButtonIndex:
Canceling
– actionSheetCancel:
Instance Methods
actionSheet:clickedButtonAtIndex:
Sent to the delegate when the user clicks a button on an action sheet.
Parameters
- actionSheet
The action sheet containing the button.
- buttonIndex
The position of the clicked button. The button indices start at
0
.
Discussion
The receiver is automatically dismissed after this method is invoked.
Availability
- Available in iOS 2.0 and later.
Declared In
UIActionSheet.h
actionSheet:didDismissWithButtonIndex:
Sent to the delegate after an action sheet is dismissed from the screen.
Parameters
- actionSheet
The action sheet that was dismissed.
- buttonIndex
The index of the button that was clicked. The button indices start at
0
. If this is the cancel button index, the action sheet is canceling. If-1
, the cancel button index is not set.
Discussion
This method is invoked after the animation ends and the view is hidden.
Availability
- Available in iOS 2.0 and later.
See Also
– actionSheet:willDismissWithButtonIndex:
Declared In
UIActionSheet.h
actionSheet:willDismissWithButtonIndex:
Sent to the delegate before an action sheet is dismissed.
Parameters
- actionSheet
The action sheet that is about to be dismissed.
- buttonIndex
The index of the button that was clicked. If this is the cancel button index, the action sheet is canceling. If
-1
, the cancel button index is not set.
Discussion
This method is invoked before the animation begins and the view is hidden.
Availability
- Available in iOS 2.0 and later.
See Also
– actionSheet:didDismissWithButtonIndex:
Declared In
UIActionSheet.h
actionSheetCancel:
Sent to the delegate before an action sheet is canceled.
Parameters
- actionSheet
The action sheet that will be canceled.
Discussion
If the action sheet’s delegate does not implement this method, clicking the cancel button is simulated and the action sheet is dismissed. Implement this method if you need to perform some actions before an action sheet is canceled. An action sheet can be canceled at any time by the system—for example, when the user taps the Home button. TheactionSheet:willDismissWithButtonIndex:
and actionSheet:didDismissWithButtonIndex:
methods are invoked after this method.
Availability
- Available in iOS 2.0 and later.
Declared In
UIActionSheet.h
didPresentActionSheet:
Sent to the delegate after an action sheet is presented to the user.
Parameters
- actionSheet
The action sheet that was displayed.
Availability
- Available in iOS 2.0 and later.
See Also
– willPresentActionSheet:
Declared In
UIActionSheet.h
willPresentActionSheet:
Sent to the delegate before an action sheet is presented to the user.
Parameters
- actionSheet
The action sheet that is about to be displayed.
Availability
- Available in iOS 2.0 and later.
See Also
– didPresentActionSheet:
Declared In
UIActionSheet.h
- IOS笔记 - UIActionSheet
- Swift开发IOS-UIActionSheet
- 【代码笔记】iOS-清除图片缓存UIActionSheet
- 【代码笔记】iOS-UIActionSheet动态添加按钮
- 【代码笔记】iOS-UIActionSheet字体的修改
- ios & UIActionSheet
- IOS UIActionSheet
- IOS UIActionSheet
- UIActionSheet笔记
- UIActionSheet笔记
- iOS学习笔记—— UIAlertView 和 UIActionSheet 的使用
- iOS开发笔记-UIActionSheet的相关属性设置
- iOS 控件系列:UIActionSheet
- iOS 之UIActionSheet应用
- iOS 自定义UIActionSheet
- 【iOS学习】----UIActionSheet
- IOS开发-UIActionSheet
- iOS UIActionSheet的使用
- 除了坚强, 我们别无选择。
- 九、自动 生成 读写措施
- 枚举_01背包
- 关于linux发行版i386/i686/x86-64/的区别
- jboss为什么要加 -b 0.0.0.0
- IOS笔记 - UIActionSheet
- 8个你不能不知道的创业教训
- 有效群組(effective group)與初始群組(initial group)
- 排序算法(源代码)
- socket关闭的close和shutdown区别
- C#线程控制ManualResetEvent和AutoResetEvent
- 中文分词的一些研究记录
- C++11
- SQL SERVER中如何使用输出参数