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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:50:55+00:00 2026-05-14T04:50:55+00:00

I have done Objective-C way back when, and have recently (i.e. just now) read

  • 0

I have done Objective-C way back when, and have recently (i.e. just now) read the documentation on Apple’s site regarding the use of retain and release. However, there is a bit of code in their Creating an iPhone Application page that has me a bit confused:

- (void)setUpPlacardView
{
    // Create the placard view -- it calculates its own frame based on its image.
    PlacardView *aPlacardView = [[PlacardView alloc] init];
    self.placardView = aPlacardView;
    [aPlacardView release];  // What effect does this have on self.placardView?!
    placardView.center = self.center;
    [self addSubview:placardView];
}

Not seeing the entire class, it seems that self.placardView is also a PlacardView * and the assignment of it to aPlacardView doesn’t seem to indicate it will retain a reference to it. So, it appears to me that the line I’ve commented ([aPlacardView release];) could result in aPlacardView having a retain count of 0 and thus being deallocated. Since self.placardView points to it, wouldn’t that now point at deallocated memory and cause a problem?

  • 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-14T04:50:55+00:00Added an answer on May 14, 2026 at 4:50 am

    I have done Objective-C way back when,

    Hi, Obj-C introduced an (evil) concept of properties in the meantime. Note that

     self.placardView=xxx;
    

    and

     self->placardView=xxx;
    

    is different. The former, by definition, calls [self setPlacardView:xxx] whereas the latter just assigns xxx into a member.
    Now, when you look at MoveMeView.h, you see the line

    @property (nonatomic, retain) PlacardView *placardView;
    

    and in MoveMeView.m

    @synthesize placardView;
    

    These tell the compiler to generate -setPlacardView: and placardView appropriately, using the standard retain/release semantics. For more details, see Apple’s documentation for properties.

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

Sidebar

Related Questions

I'm still getting the objective c way, have done some progress, but I'm stuck
I am wondering if there is a way in objective c to have my
Apple clearly has this automated in some way, I would like to have access
I have just started learning Objective-C / Cocoa Touch. I am working on an
Have done quite a bit of searching for a guide (of any substance) for
Have done some research and found some stuff that may be helpful. I would
I have done an email approval script following James Ferreira's youtube tutorial here .
I have done one program that allow user can listen to the music via
I have done some looking and I found this: http://www.codeproject.com/Articles/14439/The-ScrollableListBox-Custom-Control-for-ASP-NET-2 but to me it
I have done strace on my multi-threaded c++ application running on linux after couple

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.