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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:56:07+00:00 2026-06-14T05:56:07+00:00

Could someone explain to me why this works : SpecialView *view = [[SpecialView alloc]initWithFrame:CGRectMake(0,

  • 0

Could someone explain to me why this works :

SpecialView *view = [[SpecialView alloc]initWithFrame:CGRectMake(0, 0, 320, 164)];
self.specialView = view;
self.tableView.tableHeaderView = self.specialView;

And this doesn’t :

self.specialView = [[SpecialView alloc]initWithFrame:CGRectMake(0, 0, 320, 164)];
self.tableView.tableHeaderView = self.specialView;

Thank you very much !

EDIT 1 : The property in .h is like :

@property (weak, nonatomic) SpecialView *specialView;

When I mean it doesn’t work, I mean the at the end the self.specialView is nil.
(And yes I’m using ARC)

  • 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-14T05:56:08+00:00Added an answer on June 14, 2026 at 5:56 am

    Your property is defined as weak. This means the reference isn’t retained. It also means that when the object is deallocated, the property will be set to nil.

    In the first bit of code you assign the SpecialView instance to a local (strong) variable. This keeps the object around for a bit. Then you assign the instance to the (weak) property. This doesn’t help any. But then you assign the weak property to the table view’s header. It’s this extra reference that keeps the instance alive after the local variable view goes out of scope. But if you were to assign another header to the table or if the table view went away, the special view would be released and deallocated and the property would be reset to nil.

    In the second bit of code, you don’t have the local variable. So the object gets released and deallocated immediately and the property gets reset to nil.

    Most likely your property needs to be defined as strong instead of weak.

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

Sidebar

Related Questions

Could someone help me explain this? I have two snippets of code, one works
Could someone explain why this works. I have 2 classes in Eclipse. A Class
I'm really not getting this, so if someone could explain how this works I'd
I was kind of shocked by this. Could someone explain why this works? A
Could someone explain why this works in C#.NET 2.0: Nullable<DateTime> foo; if (true) foo
I ran across this and was wondering if someone could explain why this works
Could someone explain what method or how a form thats using this code works?
Could someone please help explain why I can't get this to work? I properly
Could someone explain this (strange) behavior? Why is the length in the first example
Could someone please explain this weird phenomenon: http://jsfiddle.net/sPA2V/ For some reason, the box footer

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.