ios - Adding a navigation controller to a tab bar application -


i have 2 questions one. first, have navigation controller put in storyboard , linked tabs , working how want to. except 1 thing. when try add code such this
[self.navigationcontroller poptoviewcontroller:vc animated:yes] error property 'navigationcontroller' not found on object of type 'appdelegate *'

is because put in wrong place? or becasue tabbar application , aint right.

it sounds you're trying make call navigation controller appdelegate. unless you've setup appdelegate work navigation controller (it'd need subclass of uiviewcontroller), you'll error because there no navigation controller on appdelegate class (by default). therefore, when make call - navigation controller can't found. notice how appdelegate subclass of uiresponder, not uiviewcontroller:

@interface appdelegate : uiresponder <uiapplicationdelegate> 

instead, create , / or connect navigation controller uiviewcontroller subclass - can make calls subclass:

[self.navigationcontroller poptoviewcontroller:vc animated:yes]; 

to create , setup navigation controller, follow these steps (may vary if aren't using storyboards).

  1. create new uinavigationcontroller obj-c subclass. in xcode menu bar, select file > new, or press cmd+n. name class , set superclass uinavigationcontroller: adding uinavigationcontroller subclass
    note don't absolutely need entirely new class! can use existing class subclass of uiviewcontroller - long navigationcontroller property available.
  2. add navigation controller objects library in xcode , set way need it.
  3. select navigationcontroller in storyboard, open utilities panel, , select identity inspector tab. set custom class name name of uiviewcontroller or uinavigationcontroller subclass: navigation controller custom class xcode 4.6
  4. from class you'll able use navigationcontroller property, among hundreds of others relating view controller. remember appdelegate place setting app , handling app events (ex. app closing, app backgrounding, app opening).

Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -