Note that there are some explanatory texts on larger screens.

plurals
  1. POIBActions are not working in another viewcontroller
    text
    copied!<p>i have created a project which has different xib viewcontrollers.In first view am selecting an image through picker controller and am displaying it in the secondviewcontroller.In secondview controller i have some buttons and i have given some IBActions to them.Here starts my problem that am successfully displaying the image in secondviewcontorller but when i tap on button in that viewcontroller app is terminating and the debugger showing the error message as <strong>program terminated due to uncaught exception</strong></p> <p>Here is the code:</p> <p>To select the pic through pickercontroller in first view</p> <pre><code>-(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 does not support a photo library" delegate:nil cancelButtonTitle:@"Drat!" otherButtonTitles:nil]; [alert show]; [alert release]; } } </code></pre> <p>displaying in the second view and assigning the actions .h file</p> <pre><code>@interface editScreen : UIViewController{ IBOutlet UIButton *btnRotate; IBOutlet UIButton *btnLibrary; IBOutlet UIImageView *imgView; int RotateAngle; } -(void)setImage:(UIImage *)img; -(IBAction)btnLibraryClicked; -(IBAction)RotateImage; @end </code></pre> <p>.m file</p> <pre><code>@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&gt;=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 does not support a photo library" delegate:nil cancelButtonTitle:@"Drat!" otherButtonTitles:nil]; [alert show]; [alert release]; } } </code></pre> <p>I dont know whats wrong with my code please help me.I have given appropriate connections in IB.. Thanks in Advance</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload