iphone - Method is not calling from another class -
i have "class-a" contains method
-(void)methoda { //logic }
i have "class-b" method
-(void)methodb { //logic }
now trying call methoda class b
so
in class b
create object of "class-a"
classa *a; @property(nonatomic,retain)classa *a; @synthesize a; -(void)methodb { [self.a methoda]; }
but method not called. doing wrong or other approach doing ?
//in class //classa.h @interface classa : nsobject -(void)methoda; @end //classa.m @implementation classa -(void)methoda { //logic } @end //in class b //classb.h #import classa.h @interface classb : nsobject @property(nonatomic,retain)classa *a; @end //classb.m @implementation classb @synthesize a; -(void)methodb { if(!self.a) self.a = [[classa alloc]init]; [self.a methoda]; //logic } @end
Comments
Post a Comment