开发者

is it possible to open a new view as we click button in UIActionSheet (for iPhone App)?

开发者 https://www.devze.com 2023-02-04 11:22 出处:网络
is it possible to open a new view as we click button in UIActionSheet? -(IBAction)showActionSheet:(id)sender {

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]

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号