ios - How to find from which view controller a method is called -
to give more specifics: working fbloginview. using storyboards , separate xib file loginviewcontroller. in app, have loginviewcontroller fbloginviewdelegate. , settingsviewcontroller fbusersettingsdelegate. , have skip button in loginview in order sign in guest instead of facebook user.
now doing is: when app opens, show walkthrough view includes login view @ bottom. when user logs in facebook login button, following method gets executed automatically via facebook sdk:
- (void)loginviewfetcheduserinfo:(fbloginview *)loginview user:(id<fbgraphuser>)user;
in method performing segue main view.
however people can choose first login guest, , go settings, , can still login facebook. happens execute same method above!
but segue isn't recognized because not in walkthrough viewcontroller anymore. in settings view controller in totally different place in hierarchy in storyboard.
so question is: how can know viewcontroller method being invoked?
i getting warning: attempt present on view not in window hierarchy!
thank helps.
myappdelegate *tmpdelegate = (myappdelegate *)[[uiapplication sharedapplication] delegate]; id mycurrentcontroller = tmpdelegate.mynavigationcontroller.topviewcontroller; nslog(@"%@", nsstringfromclass(mycurrentcontroller.class));
hope helps..
have try on this:
+ (uiviewcontroller*) topmostcontroller { uiviewcontroller *topcontroller = [uiapplication sharedapplication].keywindow.rootviewcontroller; while (topcontroller.presentedviewcontroller) { topcontroller = topcontroller.presentedviewcontroller; } return topcontroller; }
Comments
Post a Comment