当我们单击 UIActionSheet(适用于 iPhone 应用程序)中的按钮时,是否可以打开一个新视图?
当我们单击 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";
}
}
先感谢您
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,当然。您可以在此处添加视图,就像用户按下 UIButton 对象时添加视图一样。 (例如,以模态方式推送视图控制器,或使用
[self.view addSubview:viewN]
将所需视图添加到视图层次结构中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]