UIActionSheet actionSheetCancel
- (void)actionSheetCancel:(UIActionSheet *)actionSheet
Parameters of [UIActionSheet actionSheetCancel]
actionSheet
The action sheet that will be canceled.
Discussion of [UIActionSheet actionSheetCancel]
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. The actionSheet:willDismissWithButtonIndex: and actionSheet:didDismissWithButtonIndex: methods are invoked after this method.
UIActionSheet actionSheetCancel example.
To be sure to receive the delegate calls of your UIActionSheet, be sure to indicate in your controller's interface declaration (.h):
@interface YourViewController : UIViewController<UIActionSheetDelegate>
@end
Then in the controller's implementation (.m) :
- (void)actionSheetCancel:(UIActionSheet *)actionSheet {
NSLog(@"action sheet is about to be cancelled");
}
- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex {
NSLog(@"action sheet was dismissed");
}
@interface YourViewController : UIViewController<UIActionSheetDelegate>
@end
Then in the controller's implementation (.m) :
- (void)actionSheetCancel:(UIActionSheet *)actionSheet {
NSLog(@"action sheet is about to be cancelled");
}
- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex {
NSLog(@"action sheet was dismissed");
}
Example of [UIActionSheet actionSheetCancel].
-(void) showSheet:(UITabBar *)tabBar displayTitle:(NSString *)name{
UIActionSheet *menu = [[UIActionSheet alloc] initWithTitle:name
delegate:self
cancelButtonTitle:@"Done"
destructiveButtonTitle:@"Cancel"otherButtonTitles:nil];
[menu showFromTabBar:tabBar];
[menu setBounds:CGRectMake(0,0,320, 700)];
}
// actionsheet delegate protocol item
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex: (NSInteger)buttonIndex{
NSLog(@"button index = %d", buttonIndex);
}
- (void)actionSheetCancel:(UIActionSheet *)actionSheet{
NSLog(@"in action canceled method");
}