swift - How to get current view from other view controller? -


i doing sign in/sign out feature app.when try sign out,i want called current view controller viewdidappear().because want refresh view lock label available sign in user.so need know current view controller displaying in app. help?

if in navigation controller, can vc on top.

self.navigationcontroller?.topviewcontroller 

will return viewcontroller on top of stack.

you can check this other options.

to point few:

  • var topviewcontroller: uiviewcontroller?
    view controller @ top of navigation stack.

  • var visibleviewcontroller: uiviewcontroller?
    view controller associated visible view in navigation interface.

  • var viewcontrollers: [uiviewcontroller]
    view controllers on navigation stack.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -