ios - Get a pointer to controller on stack -


i have left view controller (sliding menu controller) in use example called leftmenutableviewcontroller.

when user logs out modal view controller displayed tableview controller stays in background. when login controller dismissed , others shown again.

how do following: 1. check table view controller exist on stack. 2. create pointer controller on stack without alloc init (creating one)

i need pointer can load tableview reloaddata method once logged in, if exists on stack.

there several different ways this. depends on want achieve.

i think neatest way use uiviewcontroller 2 container views, embed login view controller in 1 container view, , tableview controller in other container view.

after create references these containers in view controller, can animate each container view want to, such sliding out login view hiding it. way, "master" view controller have reference both tableview controller , login view controller.

if don't want move away method of using modal transitions between view controllers, here tell you:

there doesn't exist "stack" of view controllers anywhere describe it. have create 1 yourself, in app delegate.

in order this, need create reference view controller need pointer in app delegate, make property it, , synthesize it. this:

myappdelegate.h

@interface myappdelegate : uiresponder {     myviewcontrollerclass *myviewcontroller; } @property (nonatomic) myviewcontrollerclass *myviewcontroller; 

myappdelegate.m

@synthesize myviewcontroller; 

then, in viewdidload method of view controller....

[[[uiapplication sharedapplication] delegate] setmyviewcontroller:self]; 

after set up, can check see if pointer view controller exists saying

if([[uiapplication sharedapplication] delegate].myviewcontroller) {     //does exist } else {     //does not exist } 

to access method on view controller, like

[[[uiapplication sharedapplication] delegate].myviewcontroller performmymethod] 

hope helps you.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -