Pooja
Pooja

Reputation: 2200

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

Upvotes: 0

Views: 1029

Answers (1)

Boris Korneev
Boris Korneev

Reputation: 73

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]

Upvotes: 1

Related Questions