myCommonMethod: is a common function called from both controllers, you can check your viewController to see if it is a member of a class or does not use the isMemberOfClass: NSObject .
-(void) myCommonMethod:(UIViewController*) aViewController { if([aViewController isMemberOfClass:NSClassFromString(@"MyFirstController")]) { } else if([aViewController isMemberOfClass:NSClassFromString(@"MySecondController")]) { } }
source share