Jump to content

Whats Wrong With My Code? (Presenting Modal View)


5 posts in this topic

Recommended Posts

I'm trying to have a modal view controller that i call programmatically.

 

 

heres my code:

 

 

 

- (IBAction)searchView:(id)sender
{
   GlobalStrings* theDataObject = [self theGlobalClass];

   if (theDataObject.presentSearch == nil)
   {   
    UIStoryboard *storyboard = [uIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
    UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"SearchBarViewController"];
    [vc setModalPresentationStyle:UIModalPresentationFullScreen];

    [self presentModalViewController:vc animated:YES];
   }

   UIStoryboard *storyboard = [uIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
   UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"SearchBarViewController"];
   [vc setModalPresentationStyle:UIModalPresentationFullScreen];
}

 

 

i get a sigbart error, is it because the view controller I'm calling is a navigation controller?

 

 

i also have a similar method in my "ViewWillAppear" for my log in screen.

Link to comment
Share on other sites

Is the view controller you're trying to call before the navigation controller a navigation controller as well? You could also segue to another storyboard by programatically setting up a segue to another view controller.

 

 

 

no the login screen isn't a navigation controller.

 

segue to another story board?

Link to comment
Share on other sites

Xcode might be iffy if you try to push a navigation controller on top of one that isn't already. Not to another storyboard just within that storyboard segue from that view controller to your navigation controller would be what I would do. You want me to elaborate a bit more on that or do you understand how to segue programatically?

Link to comment
Share on other sites

Xcode might be iffy if you try to push a navigation controller on top of one that isn't already. Not to another storyboard just within that storyboard segue from that view controller to your navigation controller would be what I would do. You want me to elaborate a bit more on that or do you understand how to segue programatically?

 

 

hmm for now, i just modally called the search view controller by button, just to get over the hump, i just want it to work first and foremost.

 

 

thanks a lot though

  • Like 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...