iphone - How can a method tell which view controller called it -
i want current view controller in own method. mean have 2 view controllers calling same method. in want diffentiate view controller class calling method.
please me out
lets mycommonmethod:
common function called both view controller , check viewcontroller
whether it's member of class or not using ismemberofclass:
method of nsobject
.
-(void) mycommonmethod:(uiviewcontroller*) aviewcontroller { if([aviewcontroller ismemberofclass:nsclassfromstring(@"myfirstcontroller")]) { } else if([aviewcontroller ismemberofclass:nsclassfromstring(@"mysecondcontroller")]) { } }
Comments
Post a Comment