iphone - calling view methods from a view controller -
this simple question, , i'm sure got work in past. i'm trying call method in view
#import <uikit/uikit.h> @interface view : uiview { } -(void)spinaction; @end
from view controller
#import <uikit/uikit.h> #import "view.h" @interface layers3viewcontroller : uiviewcontroller { iboutlet view *view; } -(ibaction)spinbutton:(id)sender; @end
via method
-(ibaction)spinbutton:(id)sender{ [view spinaction]; }
but cannot work. put using interface builder. doing fundamentally wrong here? previous code worked putting
[self.view spinaction]
albeit error messages not works here. hints / suggestions more welcome.
self.view
returns object of class uiview, , shouldn't try change that. need create new outlet class of view
, , wire in interface builder.
@interface layers3viewcontroller : uiviewcontroller { iboutlet myview *myview; } @property (nonatomic,retain) iboutlet myview *myview; -(ibaction)spinbutton:(id)sender; @end
in implementation should this:
@implementation layers3viewcontroller @synthesize myview; -(ibaction)spinbutton:(id)sender{ [self.myview spinaction]; }
don't forget connect myview outlet in interface builder view.
Comments
Post a Comment