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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:09:35+00:00 2026-05-25T06:09:35+00:00

A beginner here, developing for the iPhone, with an extremely simple question: What is

  • 0

A beginner here, developing for the iPhone, with an extremely simple question: What is the reason behind declaring a method in a header file, and then filling it out in the implementation file? Does this always have to be done?

Also, I know to declare variables in the @interface of the header file, but why are they only sometimes repeated with the @property tag? Is this for variables that other classes may wish to read from or write to (hence why they automatically create getter and setter methods)?

Kind regards.

  • 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-25T06:09:35+00:00Added an answer on May 25, 2026 at 6:09 am

    Declaring a method in .h file is known as forward declaration. If you declares a method header in the .h file then the compiler will know the method name, parameters and return type before the actual linking. You can write a method body only in the .m file. But that method can be used only by methods declared after it in that file. But if you declare a method in the header then it won’t be a matter. Because then the method signature will be know to all during the first pass of compiler and will be linked in the second pass.

    @property and @synthesize tags are used to create automated getters and setters (or Accessors and Mutators, in Objective-C terminology), but there is more. In iOS you have to do memory management manually (it should be changed in iOS5, as apple promised). In the @property tag you can tell how the memory will behave during an assignment.

    iOS tracks the memory management of an object by maintaining a retain count. When you allocate an object it’s retain count becomes 1. Then you can manually increase the retain count by the retain method (e.g. [myObj retain]) or decrease the retain count by the release method (e.g. [myObj release]). When the retain count falls to 0 iOS delete that object from memory. With the @property tag you can define how retain count will be manage during an assignment. For example two mostly used parameters in the @property tag are:

    @property (nonatomic, retain)
    @property (nonatomic, assign)
    

    In the first case during an assignment the retain count of the object will be increased by 1 automatically (e.g. self.myObj = anotherClass.anotherObjOfSameClass;) and in the later case the retain count would not be increased.

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

Sidebar

Related Questions

Beginner here, I have a simple question. In Android what would be the best
Beginner question here. In the .h file of an objective c class.. If you
Python beginner here, so I apologize if this question has a simple answer. (I
Bit of a beginner question here: Say I have a block of xml: <root>
Once again a very beginner-ish question, but here I go: I would like to
Beginner level question Scenario: Have simple string cocantation tool, that I might expand later
Absolute beginner question: I have a template file index.html that looks like this: ...
Beginner here! Forgive me in advance for raising what is probably an incredibly simple
Beginner here: In this answer to my question of how to insert data into
Okay here is a softball beginner WPF question. By default the background of the

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.