Jump to content

fluid | fixed

Whats Wrong With My Code? (Presenting Modal View)

iOS xcode iphone App programming ipad tabbar navigation view controller ios6

  • Please log in to reply
4 replies to this topic

#1
LooN3y

LooN3y

    InsanelyMac Protégé

  • Members
  • Pip
  • 24 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.

#2
TH3L4UGH1NGM4N

TH3L4UGH1NGM4N

    (~_~)

  • News Team
  • 1,110 posts
  • Gender:Male
  • Location:Wonderland
  • Interests:(~_^)
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.

#3
LooN3y

LooN3y

    InsanelyMac Protégé

  • Members
  • Pip
  • 24 posts

View PostTH3L4UGH1NGM4N, on 13 June 2012 - 05:30 PM, said:

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?

#4
TH3L4UGH1NGM4N

TH3L4UGH1NGM4N

    (~_~)

  • News Team
  • 1,110 posts
  • Gender:Male
  • Location:Wonderland
  • Interests:(~_^)
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?

#5
LooN3y

LooN3y

    InsanelyMac Protégé

  • Members
  • Pip
  • 24 posts

View PostTH3L4UGH1NGM4N, on 15 June 2012 - 04:18 AM, said:

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





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

© 2013 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   Web hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy