Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

IphoneStruggler

macrumors newbie
Original poster
Hi!!
Am new to this forum and also new to IPhone development.

Following is the issue:
I have two views named firstviewcontroller and secondviewcontroller which has different xib files.
I choose a picture through the UIImagePickerController interface from the Photo Library, I was trying to display the chosen image in the second view.
Code:
pickerController is my first view controller 
pickerController.h file

#import <UIKit/UIKit.h>
#import "SecondViewController.h"

@interface pickerControllerViewController :  UIViewController<UIActionSheetDelegate,UIImagePickerControllerDelegate,UINavigationControllerDelegate> {
	IBOutlet UIButton *selectpic;
	IBOutlet UIImageView *imageView;
}
@property (nonatomic,retain) UIImageView *imageView;
@property (nonatomic,retain) UIButton *selectpic;
-(IBAction)getpic:(id)sender;
//-(void)goNext: (UIImagePickerController *)picker;
@end


pickerController.m fie
#import "pickerControllerViewController.h"

@implementation pickerControllerViewController
@synthesize imageView,selectpic;
-(IBAction)getpic:(id)sender
{
	UIImagePickerController *picker = [[UIImagePickerController alloc]init];
	picker.delegate = self;
	picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
	[self presentModalViewController:picker animated:YES];
}
-(void)imagePickerController:(UIImagePickerController *)picker  didFinishPickingMediaWithInfo:(NSDictionary *)info 
{
	
	imageView.image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
	[[picker parentViewController] dismissModalViewControllerAnimated:YES];
	SecondViewController *secview = [[SecondViewController alloc]initWithNibName:nil bundle:nil];
	[secview setImage:imageView];
	
}

SecondVIewController.h file


@interface SecondViewController :UIViewController{
	IBOutlet UIImageView *imageView2;

}
-(void)setImage:(UIImage *)image;
@end

SecondVIewController.m file
@implementation SecondViewController
-(void)setImage:(UIImage *)image{
	imageView2 = image;

}

It is not showing any error.Am not able to display the image in the secondview.
please help, am struck here for the last 1 week and i could not find any solution for this...😕

Thanks for the help in Advance!!!!!!!!!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.