Search code examples
iosxcode4modalviewcontroller

XCode/Storyboard:Creating a Modal View


I'm reading through the apple developer library and would like to use a submenu like apple shows in a picture:

enter image description here

First question: Is that a modal view? And if yes, how to create something like that? Does this submenu has its own controller and view or is all that declared in the view above? I'm using storyboard.


Solution

  • Nope this is an UIActionSheet, it does not have a nib file or a class file, you use it like this

    UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"Title" 
                                                       delegate:self 
                                              cancelButtonTitle:@"cancel"
                                         destructiveButtonTitle:nil
                                              otherButtonTitles: nil];
    [sheet showInView:self.view];
    
    //Function gets called when user taps on a button
    -(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
    {
    
    }