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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:24:41+00:00 2026-05-30T16:24:41+00:00

In the xcode, after you creating a UIViewController subclass, in the viewDidUnload method, there

  • 0

In the xcode, after you creating a UIViewController subclass, in the viewDidUnload method, there is a comment added by xcode:

- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

Here, xcode recommends us to use self.myOutlet=nil to release object.

But in xcode4, there is a cool feature: you can just drag a Interface Builder outlet to its owner’s header file, then xcode will automatically create the IBOutlet object and relevant release code in viewDidUnload method.

The problem is in above scenario, it generated code is something like this:

- (void)viewDidUnload {
    [super viewDidUnload];
    [self setFoo:nil];
}

I mention that the “self.foo = nil;” is replaced by “[self setFoo:nil];”.

Does anybody know the difference? If there is no difference, why xcode4 changes it?

Thanks.

  • 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-30T16:24:42+00:00Added an answer on May 30, 2026 at 4:24 pm

    In the executable, there is no difference between the two syntaxes. The only technical reason I can think of for Xcode to use the setter method explicitly is for compatibility with pre-Objective-C 2.0 code, which didn’t support dot-syntax. I don’t know why Xcode would need to support that compatibility; maybe the part of Xcode that generates the set-to-nil expression is older than Objective-C 2.0.

    Or maybe the person who wrote that part of Xcode simply doesn’t like dot-syntax. When dot-syntax was first introduced, a lot of people didn’t like it.

    http://weblog.bignerdranch.com/?p=83
    http://www.cimgf.com/2008/07/08/a-case-against-dot-syntax/
    http://cocoawithlove.com/2008/08/in-defense-of-objective-c-20-properties.html

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

Sidebar

Related Questions

After I updated to Xcode 4.2, I can no longer release anything. When I
I'm using xCode 4.2, and after creating the .h and .m classes separately, I
I just started to develop with with Xcode 4.2 and iOS5. After creating empty
iam trying play animation with xcode,in specefic Time for example after 3 minutes play
OS X 10.5.6, Xcode 3.1 with iPhone support. After compiling some apps for iPhone
Xcode automatically resizes and applies a glossy look to images added as the application
I had created a project using base sdk 5.0 in xcode 4.2. While creating
After upgrading Xcode to the 4.2, I'm going through and fixing all the new
After installing XCode 4 I went to the Organizer window to try to verify
After upgrade to Snow Leopard and downloading the new Xcode along with all new

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.