Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1072875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:55:09+00:00 2026-05-16T20:55:09+00:00

I am new to iPhone development. I have two views named pickerviewcontroller and secondviewcontroller

  • 0

I am new to iPhone development. I have two views named pickerviewcontroller and secondviewcontroller which have different xib files. I choose a picture through the UIImagePickerController interface from the Photo Library, and I was trying to display the chosen image in the second view. 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;
  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. I am not able to display the image in the secondview.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T20:55:10+00:00Added an answer on May 16, 2026 at 8:55 pm

    In firstviewcontroller.m

    <#import "pickerExampleViewController.h"
    
    @implementation pickerExampleViewController
    @synthesize selectPic;
    -(IBAction)getpic:(id)sender
    {
        UIImagePickerController *picker = [[UIImagePickerController alloc]init];
        picker.delegate = self;
        picker.editing  = YES;
        picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
        [self presentModalViewController:picker animated:YES];
        [picker release];
    }
    
    #pragma mark imagePickerController delegate methods
    
    -(void)imagePickerController:(UIImagePickerController *) picker
           didFinishPickingImage:(UIImage *)image 
                     editingInfo:(NSDictionary *)editingInfo  
    {
        [picker dismissModalViewControllerAnimated:YES];
        Second *secview = [[Second alloc] initWithNibName:@"Second" bundle:nil];
        secview.view.backgroundColor = [UIColor blackColor];
        [secview.imgView setImage:image];
        [self.view addSubview:secview.view];
        [secview release];
    }
    
    
    - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
    {
        [self dismissModalViewControllerAnimated:YES];
    }<
    

    In second.m you have to write

    <#import "Second.h"
    
    @implementation Second
    @synthesize imgView;
    
    -(void)setImage:(UIImage *)img
    {
        [imgView setImage:img];    
    }
    -(IBAction)back
    {
        [self.view removeFromSuperview];
    }
    
    -(void)dealloc
    {
        [imgView release];
        [super dealloc];
    }
    @end
    <
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im new to iPhone development and I have really taken this to me. I
I am primarily a web developer (ruby, python) that is new to iPhone development.
I'm new to iPhone development, and doing some experimentation with Core Animation. I've run
I'm just starting iPhone development (coming fron a .Net world) and have been going
I am new to iPhone development. I want to insert certain data into my
I've recently been doing a lot of Objective-C programming, and just got back into
I'm following a tutorial on how to use Interface Builder from Chapter 2 of
(Note: This is an extension of a previous question .) I am having some
Similar to the known memory leak issue regarding creating and destroying an instance of
I spent a long time learning how to customise WCF from the point of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.