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:

  1. 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)

  2. i @class paint inside paintviewcontroller.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

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -