Whats Wrong With My Code? (Presenting Modal View)


i'm trying have modal view controller call programmatically.


heres code:



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];  }  

sigbart error, because view controller i'm calling navigation controller?


have similar method in "viewwillappear" log in screen.
 

first, first line return. if object singleton, use class name, not self.

code doesn't make sense in simple way. test , if passes setup view controller , display it. after try set version of view controller. have assume code fake, hack post, or not thought out.

i'm not familiar storyboards, when create app , choose storyboarding, isn't main storyboard named mainstoryboard default, loaded upon app startup?

if i'm right mainstoryboard existing , code within view controller within story board, should use 'storyboard' method against self id. trying create new copy. have wonder if creating vc new copy of mainstoryboard , using in current copy has consequences.

docs instantiateviewcontrollerwithidentifier: "before can use method retrieve view controller, must explicitly tag appropriate identifier string in interface builder." _it_ being view controller.

way, presentmodelviewcontroller has been deprecated. read docs see replacement. don't think issue @ time.
 


Forums iPhone, iPad, and iPod Touch iOS Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

Comments

Popular posts from this blog

Rogue - the old text based game. I can't find it!

RAID in Early 2009 Mac Pro

NBC Releases Summer Olympics iOS Apps, Offering Livestreaming of All 302 Events