是否可以在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";
}
}
提前谢谢
答案 0 :(得分:1)
是的,当然。如果用户按下UIButton对象,您可以像添加视图一样添加视图。 (例如,以模式方式推送视图控制器,或使用[self.view addSubview:viewN]