Search code examples
iphoneobjective-cxcode4ios5

distinguish where the user has come from


I can see there being a very simple answer to this but I will ask anyway. I have two viewControllers that navigate to the same viewController is there a way to distinguish which viewController the user has come from out of the two. As I need to run different methods based on which ever page they have come from?


Solution

  • What you need to do is just add a NSString *previousPage; as a property of your common page. When you go to your common page either page1 or page2, you just need to set the property of your common page and you can do anything that you want based on previousPage value.