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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:25:06+00:00 2026-06-13T09:25:06+00:00

I have not clear how Objective C handle the local and member variable, as

  • 0

I have not clear how Objective C handle the local and member variable, as I am new to this.
Consider I am creating a view inside a function like this…

fun () {
   new_class *var = [new_class alloc] init]

   // some code to push the view here...
}

everything works fine here, now my question is var is a local variable, when the function scope ends, will it die or not? if it dies how the view is working properly when I am doing some action in 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-06-13T09:25:07+00:00Added an answer on June 13, 2026 at 9:25 am

    The var should be release, if it doesn’t have other objects point at it. The thing is:

    if it dies how the view is working properly when I am doing some action in it
    

    If your “var” is an UIView for instance, and you [self.view addSubview:var], now you have two objects pointing at it: *var and your self.view, that’s why everything is ok.

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

Sidebar

Related Questions

First of all i have to clear few things 1.This is not spam group
I have read this question and the simple and clear answer but it's not
The title is not very clear, so I'll try to explain better. I have
Sorry the title may not be very clear. Basically I have a wrapper for
The .NET MemoryStream does not appear to have a .Reset or .Clear method. I
Let's say I have 10 breakpoints and I want to clear one but not
I have not had to do something like this in the past and am
I have not started creating the code so I don't have anything to show,
im fairly new to objective-c, most of it is clear however when it comes
This question is about variable naming style in objective c and cocoa. I just

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.