iphone - Interact with a view controller from another view controller -


i want view controller check if there image on view controller when click button. of there image simulator not execute loop.

code:

- (ibaction)buttonclicked:(id)sender {      iphotoviewcontroller *photo = [[iphotoviewcontroller alloc] initwithnibname:@"iphotoviewcontroller" bundle:nil]  ;       if (photo.mainview.image)     {         = (uibutton *) sender;         self.selectedimage = [_images objectatindex:but.tag];          iphoto2appdelegate *delegate = [[uiapplication sharedapplication] delegate];         [delegate.navcontroller popviewcontrolleranimated:yes];          [photo release];     } 

thanks, praveen

you creating new instance of iphotoviewcontroller means image want use must available in nib file. , being available in nib file means available in project creating new iphotoviewcontroller see if image there seems bit strange.

is there perhaps instance of iphotoviewcontroller somewhere have loaded image? if instance need check.

but perhaps testing things , have set image in nib , want make sure works. in case, reason photo.mainview.image not set because have created view controller view not yet been loaded , setup nib. fake need access view property of controller before checking if image set.

iphotoviewcontroller *photo = [[iphotoviewcontroller alloc] initwithnibname:@"iphotoviewcontroller" bundle:nil] ;  [photo view]; if (photo.mainview.image) { // continue before 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -