is it possible to open a new view as we click button in UIActionSheet (for iPhone App)?
is it possible to open a new view as we click button in UIActionSheet?
-(IBAction)showActionSheet:(id)sender {
UIActionSheet *Query = [[UIActionSheet alloc] initWithTitle:@"Title" delegate:self cancelButtonTitle:@"Cancel Button" destructiveButtonTitle:@"Destructive Button" otherButtonTitles:@"Button1", @"Button2", nil];
Query.actionSheetStyle = UIActionSheetStyleBlackOpaque;
[Query showInView:self.view];
[Query release];
}
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 0) {
view 1
} else if (buttonIndex == 1) {
view 2
} else if (buttonIndex == 2) {
view 3
} else if (buttonIndex == 3)开发者_开发知识库 {
self.label.text = @"Cancel Button Clicked";
}
}
Thank you in advance
Yeah, of course. You can add your views here the same way you would add it if the user was pressing the UIButton object. (e.g. push view controller modally, or adding the required view to your view hierarchy with [self.view addSubview:viewN]
精彩评论