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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:43:38+00:00 2026-06-07T22:43:38+00:00

When displaying an item such as a button in a ViewController, I declare it

  • 0

When displaying an item such as a button in a ViewController, I declare it in the header file:

@property (nonatomic, strong) UIButton *startButton;

Synthesize it in the implementation file:

@synthesize startButton;

Initiate it in the implementation file:

startButton = [[UIButton alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];

And set the reference to nil in viewDidUnload:

[self setStartButton:nil];

However, what if I have 60 listed items (in a UIScrollView) which are created dynamically in a loop, in viewDidLoad (fed from Core Data)?
(Not using TableView, because the items are quite complicated and interactive.)

Should I declare the items anywhere first? Should I set them to nil anywhere? (Or should I just keep my fingers crossed and pray to the Arc?)

Some guidance would be appreciated. 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-07T22:43:39+00:00Added an answer on June 7, 2026 at 10:43 pm

    Does your view controller have properties or instance variables that point to each of those 60 items?

    Yes: Then set those ivars or properties to nil in your -viewDidUnload.

    No: Then there’s nothing to worry about.

    ARC changes what you do to manage memory, but it doesn’t change the basic philosophy, which is that every object should take care of its own references to other objects but not worry about anybody else’s.

    In this case, the view that contains all those items will have strong references to the items (via it’s array of subviews). When the view controller releases its view, that view will then be deallocated and release all its subviews in the process. So all those items will be taken care of. If you did have strong references to any of those items, those references will prevent the referenced objects from being deallocated — setting the references to nil will avoid that.

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

Sidebar

Related Questions

How can I override default behavior of displaying item label on the input when
So I have a listview that is displaying correctly. When the item is turned
is there any Flex component displaying tag clouds ? (Each array item is composed
actually i am displaying a pop up with ok cancel button when user clicks
I have a popup window displaying when I click an item in my list
I am creating a business item formatter (spread) where while displaying i want to
Displaying Type here to ... until the user enters text into a TextBox is
When displaying all articles of a specific month (given through the urls like this
When displaying a group of JRadioButtons, initially none of them is selected (unless you
When displaying a confirm box in javascript, there seems to be a delay after

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.