iphone - Changed nib File to a OPGL ES View, Buttons don't work -


hy,

there no problmen changing nib when i'm in nib-file opgl es view buttons integrated in view won't work. when press 1 application crashes.

this code how change view second nib:

- (ibaction)draweaglview:(id)sender {  nsarray* nibviews =  [[nsbundle mainbundle] loadnibnamed:@"settingsviewcontroller" owner:self options:nil]; eaglview* glview = [ nibviews objectatindex: 1]; self.view = glview; [glview startanimation];} 

the animation working .

this code of viewcontroller button declared:

settingsviewcontroller.h:

#import <uikit/uikit.h>   @interface settingsviewcontroller : nsobject {      iboutlet uibutton *wowbutton; } @property(nonatomic,retain) iboutlet uibutton *wowbutton;  - (ibaction)wowbuttonpressed:(id)sender;  int testvaranimation; int animnext;   @end 

settingsviewcontroller.m:

#import "settingsviewcontroller.h" @implementation settingsviewcontroller @implementation settingsviewcontroller @synthesize wowbutton;   - (ibaction)wowbuttonpressed:(id)sender{     nslog(@"touched");     //testvaranimation = 1;     animnext =1;  }  - (void)dealloc {     [wowbutton release];     [super dealloc]; }   @end 

here show how connected functions , outlets: http://s3.imgimg.de/uploads/screenshotconna91ea645png.png

please tell me if need more informations.

thanks

hy solved problem, rewrote draweaglview methode:

- (ibaction)draweaglview:(id)sender {      settingsviewcontroller *sviewcontroller = [[settingsviewcontroller alloc] initwithnibname:@"settingsviewcontroller" bundle:nil];         [[self.view superview] addsubview:sviewcontroller.view];      } 

i corrected settingsviewcontroller.h:

#import <uikit/uikit.h>   @class eaglview;  @interface settingsviewcontroller : uiviewcontroller {      iboutlet uibutton *wowbutton;      eaglview *glview; } @property(nonatomic,retain) iboutlet uibutton *wowbutton; @property (nonatomic, retain) iboutlet eaglview *glview;  - (ibaction)wowbuttonpressed:(id)sender;  int testvaranimation; int animnext;   @end 

and last not least changed settingsviewcontroller.m:

#import "settingsviewcontroller.h" #import "eaglview.h"    @implementation settingsviewcontroller  @synthesize wowbutton, glview;   - (ibaction)wowbuttonpressed:(id)sender{     nslog(@"touched");     //testvaranimation = 1;     animnext =1; }  - (void)viewdidload {     glview.animationinterval = 1.0 / 60.0;     [glview startanimation];      [super viewdidload]; } - (void)dealloc {     [wowbutton release];     [super dealloc]; }   @end 

i changed nib file. removed viewcontroller , set type of file's owner viewcontroller named "settingsviewcontroller". connected file's owner outlet view eaglview , button settingsviewcontrollers wowbuttonpressed method

i hope else,

thanks


Comments