iphone - ios Calling back viewController from different class -


i have problems calling viewcontroller nsobject class. here code:

viewcontroller:

-(void)starttest:(nsstring*)testtorun {     viewcontroller *viewcontroller = [[[viewcontroller alloc] init] autorelease];     secondclass *secondclass = [[secondclass alloc] init];     secondclass.viewcontroller = viewcontroller;     [secondclass dosomething]; }  -(void) createview {     uiview *newview = [uiview alloc] initwithframe:[self.view bounds];     self.newview.backgroundcolor = [uicolor whitecolor];     [self.view addsubview:newview];     [self.view bringsubviewtofront:newview] }   nsobject classe:  .h file  #import "viewcontroller.h"  @class viewcontroller;  @interface secondclass : nsobject {     viewcontroller *viewcontroller; }  @property (nonatomic,retain) viewcontroller *viewcontroller;  -(void) dosomething;   .m file  -(void) dosomething {     [viewcontroller createview];  } 

any of may know i'm doing wrong or how can call view controller nsobject class?

you're referring instance variable viewcontroller assigning property viewcontroller.

the property automatically synthesized instance variable called _viewcontroller default. can change explicitly synthesize instance variable, more canonical thing use default _viewcontroller , refer self.viewcontroller within implementation file.


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -