IOS - Call an instance method of a class from another class button -
i have instance methods implemented in class 2d painting; , image rendered view declared in paintviewcontroller.
these methods (like clearimage, changebrushcolor) working if call them code generated buttons inside same class.
but want use uikit make graphic, buttons ecc , empty view paint in.
i've tried ways call instance methods other classes none of them seems working..
can explain me step step how this?
these ways i've tried:
in
paintviewcontroller.m
#import "paint.h"
call erase method this- (ibaction)erasebutton:(id)sender { paint *newinstance = [[paint alloc]init]; [newinstance clearimage]; }
it method called not working.. (if put nslog inside method prints stuff)
i
@class paint
insidepaintviewcontroller.h
, set property in interface@property (strong, nonatomic) paint *paint;
, inside ibaction write[self.class clearimage];
this not working @ all.
if read question correctly, need implement delegate method. commonly used pattern in objective-c in scenario. have similar answer sample code in this so post.
Comments
Post a Comment