当我们单击 UIActionSheet(适用于 iPhone 应用程序)中的按钮时,是否可以打开一个新视图?

发布于 2024-10-12 02:15:35 字数 852 浏览 4 评论 0原文

当我们单击 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

似狗非友 2024-10-19 02:15:35

是的,当然。您可以在此处添加视图,就像用户按下 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]

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文