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

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -