ios - Call controller function from other class -


i have question:

i have open controller called login.xib, has method showerrorpopup should triggered when data server says login or password wrong or there no internet.

but problem web request processed in other class file - dataservices.m

the question is, how can trigger showerrorpopup other class file?

you can set controller in dataservices.m. declare un variable of type "login" in dataservices.m, like:

@property (nonatomic) login *mylogin; 

then when call dataservices:

dataservices *ads = [[dataservices alloc] init]; ads.mylogin  = self; //if call login. 

then, in function in dataservices.

-(void)myfunction { if (self.mylogin && [self.mylogin respondtoselector:@"afunction"]) {      [self.mylogin performselector:@"afunction"];  //... } 

hope helps.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -