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

  • SEARCH
  • Home
  • 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 8305231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:03:17+00:00 2026-06-08T18:03:17+00:00

I have a (retained) UIImage property that is being used to hold a user

  • 0

I have a (retained) UIImage property that is being used to hold a user selected image.

This is the code I have at present when the user makes a selection:

- (IBAction) selectImage1 {
    UIImage *image = [UIImage imageNamed: @"image1-big.png"];
    self.bigImage = image;
} 

but I’m wondering if it is possible to omit the use of the temporary variable convenience method and just do this:

- (IBAction) selectImage1 {
    self.bigImage = [UIImage imageNamed: @"image1-big.png"];
} 

If there are problems with this second method (I’m guessing something to do with memory management), could someone please explain?

Thank you!

  • 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-06-08T18:03:21+00:00Added an answer on June 8, 2026 at 6:03 pm

    The second way is perfectly fine. The line UIImage *image = [UIImage imageNamed: @"image1-big.png"]; gives you a variable image that is auto-released. Assigning it to your ivar via the self.bigImage = image calls bigImage‘s setter method which retains the value. Thus the line self.bigImage = [UIImage imageNamed: @"image1-big.png"]; is equivalent to the more verbose way.

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

Sidebar

Related Questions

I have the next piece of code, one iVar with this property retained and
I have this retained property declared like this: @property (nonatomic, retain) NSMutableDictionary *codes; then
I have a mutable array that has been retained. This array contain dictionaries with
I have a mutable array that is retained and storing several objects. At some
have a problem. At first look at this HTML <div id=map style=background-image: url(map.png); width:
I have a UIViewController and in that controller, i am fetching an image from
I have a custom NSView object with a retained property named bgColor. I override
I have a table that has a forced auto increment column and this column
I have a @property which is defined like this : @property (nonatomic, retain) name;
Have data that has this kind of structure. Will be in ascending order by

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.