iphone - IBActions are not working in another viewcontroller -


i have created project has different xib viewcontrollers.in first view selecting image through picker controller , displaying in secondviewcontroller.in secondview controller have buttons , have given ibactions them.here starts problem displaying image in secondviewcontorller when tap on button in viewcontroller app terminating , debugger showing error message program terminated due uncaught exception

here code:

to select pic through pickercontroller in first view

-(ibaction)btnchoosepicclicked {     if([uiimagepickercontroller         issourcetypeavailable:uiimagepickercontrollersourcetypephotolibrary])     {         uiimagepickercontroller *picker=[[uiimagepickercontroller alloc] init];         picker.delegate=self;         picker.sourcetype=uiimagepickercontrollersourcetypephotolibrary;           [self presentmodalviewcontroller:picker animated:yes];         [picker release];      }     else      {         uialertview *alert =[[uialertview alloc]initwithtitle:@"error accessing photo library"   message:@"device not support photo library" delegate:nil cancelbuttontitle:@"drat!"                   otherbuttontitles:nil];          [alert show];         [alert release];     }  } 

displaying in second view , assigning actions .h file

@interface editscreen : uiviewcontroller{     iboutlet uibutton *btnrotate;     iboutlet uibutton *btnlibrary;     iboutlet uiimageview *imgview;     int rotateangle; } -(void)setimage:(uiimage *)img; -(ibaction)btnlibraryclicked; -(ibaction)rotateimage; @end 

.m file

@implementation editscreen -(void)setimage:(uiimage *)img {     [imgview setimage:img];     imgview.userinteractionenabled = yes; } -(ibaction)rotateimage {     cgaffinetransform transform = imgview.transform;     transform = cgaffinetransformrotate(transform, m_pi/2);     imgview.transform=transform;      rotateangle+=90;      if(rotateangle>=360)     {         rotateangle-=360;     }     //imageview.transform = cgaffinetransformscale(imageview.transform, -1.0, 1.0); } -(ibaction)btnlibraryclicked {       if([uiimagepickercontroller                   issourcetypeavailable:uiimagepickercontrollersourcetypephotolibrary])     {         uiimagepickercontroller *picker=[[uiimagepickercontroller alloc] init];         picker.delegate=self;         picker.sourcetype=uiimagepickercontrollersourcetypephotolibrary;           [self presentmodalviewcontroller:picker animated:yes];         [picker release];         // nsfilehandle *filehandle = [[nsfilehandle alloc]initwithfiledescript     }     else      {         uialertview *alert =[[uialertview alloc]initwithtitle:@"error accessing photo library" message:@"device not support photo library" delegate:nil cancelbuttontitle:@"drat!" otherbuttontitles:nil];          [alert show];         [alert release];     }  } 

i dont know whats wrong code please me.i have given appropriate connections in ib.. in advance

for uikit class, delegate has methods must implemented. example, uiimagepickerviewcontrollerdelegate must implement following methods:

  • – imagepickercontroller:didfinishpickingmediawithinfo:
  • – imagepickercontrollerdidcancel:

for above codes, don't know whether these methods implemented or not. hope these information can you.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -