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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:17:08+00:00 2026-05-22T18:17:08+00:00

I switched to Xcode 4 recently and I don’t really understand this new way

  • 0

I switched to Xcode 4 recently and I don’t really understand this new way to write accessors.
For example, in the application delegate class that is auto-generated when creating a new project, the window object is not declared in the @interface but just this way:

@property (nonatomic, retain) IBOutlet UIWindow *window;

Then, in the implementation file, we have the @synthesize window=_window;.
And in the functions, we have either self.window OR _window.

For example:

[self.window makeKeyAndVisible]; // in didFinishLaunchingWithOptions function
[_window release]; // in dealloc function

Can you explain me the difference, why there is nothing in the @interface, why we do @synthesize window=_window; instead of @synthesize window; and what is the difference between self.window and _window, I mean when do I have to call one more than the other?

I’m a bit lost, and feel like the new code I doing trying to do the same in not working properly…

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-22T18:17:09+00:00Added an answer on May 22, 2026 at 6:17 pm
    1. “Why is there nothing in the @interface“

      The runtime is synthesizing the ivar for you.

    2. “Why do we do @synthesize window=_window;

      This means that the window property will use an ivar named _window (by default the ivar name is the name of the property)

    3. “What is the difference between self.window and _window?”

      The former is using the window “getter” method (ie, foo = [self window]), and the latter is accessing the ivar directly.

    4. “Why do I have to call one more than the other?”

      It is generally considered unsafe to use accessor methods in your dealloc method, which means using the ivar is preferred.

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

Sidebar

Related Questions

I've recently switched to Linux on my work machine and, new to the Linux
I switched my DAL from using LINQ over to Entity Framework. Because my application
I've switched over to a Mac recently and, although things have been going quite
I've recently switched from being an employee of a small consulting company to being
I've just switched an application to use ar_mailer and when I run ar_sendmail (after
We recently switched our Windows software packages from RPM (cygwin) to MSI (wix). Having
I switched to xcode 3.2.3 last week and curiously I cannot display variable values
Recently switched to XFBML to make our page more efficient. However, we noticed that
I switched from Intelligencia's UrlRewriter to the new web forms routing in ASP.NET 4.0.
I switched computers, so to copy my projects from xcode, I uploaded the whole

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.