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 3354844
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:19:23+00:00 2026-05-18T02:19:23+00:00

I have a UIImageView that I’d like to load with a picture coming from

  • 0

I have a UIImageView that I’d like to load with a picture coming from an instance of UIImagePickerController in order to show a preview to the user. My app has a TabBarViewController and in order to hide the bar I’m showing both the picker and the preview modally.

The controller I use for the preview has been built on Interface Builder and it holds an empty UIImageView. When the picture has been taken, I was trying to set the image of the UIImageView but the IBOutlet was always nil. This is what I came up to in order to achieve what I was looking for:

[self.view addSubview:self.previewController.view];     
[self.previewController.imageView setImage:self.scaledPicture];     
[self presentModalViewController:self.previewController animated:YES];

I’m still not sure this is the right approach but if I don’t use the first line above, the self.previewController.imageView will be nil. The visual effect of the line has no impact because the modal view covers everything…

I checked the links in IB many times and they all appear to be correct.

Is this the right way to proceed?

  • 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-18T02:19:23+00:00Added an answer on May 18, 2026 at 2:19 am

    If you have just created previewController, then its imageView will be nil because the view has not loaded. The reason that the first line seems to make it work is because it causes the view to load.

    What you should do is have an image property on the previewController which you can assign here. Then load the image into the imageView in the previewController’s viewDidLoad. This way, you’re also avoiding poking at another view controller’s views.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Example: I have an class that inherits from UIImageView. An object creates an instance
I have a UIImageView that's being loaded from a NIB. I've hooked up a
I have a UIImageView that contains an image of a circle. I would like
I have a UIImageView that I would like to change its image with animation.
I would like to have an UIImageView that flickers. I thougt I can make
I have an UIImageView that tries to load an image and if it does
I have a UIImageView that I dynamically load with an Image using myTableViewCell.myImageView.image =
I have a UIImageView that starts off with an image (loading.png) specified in IB.
I have a UIImageView that is displaying a series of pictures as an animation.
I have a UIImageView that is housed inside a UIScrollView . The image in

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.