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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:27:02+00:00 2026-05-25T01:27:02+00:00

I’m trying to incorporate and modify the expanding section headers from WWDC 2010 vol128

  • 0

I’m trying to incorporate and modify the expanding section headers from WWDC 2010 vol128 Mastering Table Views. However, I must have missed a step or forgot something because I’m getting the EXC_BAD_ACCESS error when I try to access my view with the table view.

I forget where you can find the source code, but it’s on their developer website. It’s a lot of code to post.

The main difference I see is that their version adds the subclass of UITableViewController as a subview to their appdelegate ie. window. I want to add my controller to my scrollview which is in a viewcontroller. I’m sure there is an issue because of that?

The original below makes no sense to me because it releases the aTableViewController before adding it as a subview, which in my version I cannot do. It also makes self.tableViewController = aTableViewController; the tableViewController is synthesized at the top like this:
@synthesize tableViewController=tableViewController_ I dont know where it comes from since it is not referenced anywhere else in the project. Again, the original had this code in the app delegate, so maybe there’s something I dont know that is going on there.

Apple’s code (it works):

 TableViewController* aTableViewController = [[TableViewController alloc] initWithStyle:UITableViewStylePlain];
    aTableViewController.plays = self.plays;
    self.tableViewController = aTableViewController;
    [aTableViewController release];

    // Stamdard window display.
    [self.window addSubview:aTableViewController.view];
    [self.window makeKeyAndVisible];

For testing purposes, I made an empty testTableViewController subclass which is virtually empty, and tried to add it as a subview with the same outcome. Perhaps, I’m creating a UITableViewController subclass incorrectly. Sorry, for being vague, but I think it has something to do with the snippet of information given above.

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-25T01:27:03+00:00Added an answer on May 25, 2026 at 1:27 am

    To answer this:

    The original below makes no sense to me because it releases the
    aTableViewController before adding it as a subview

    You mentioned:

    it also makes self.tableViewController = aTableViewController; the
    tableViewController is synthesized at the top like this: @synthesize
    tableViewController=tableViewController_ I dont know where it comes
    from since it is not referenced anywhere else in the project.

    Most likely, if you look in the header file, you’ll see a line like this:

    @property (nonatomic, retain) tableViewController;
    

    This is a “Declared Property” in Objective-C. Declared properties provide a super-convienient way of getting/setting ivars with common patterns (such as retaining any value assigned to them).

    From the documentation:

    The Objective-C declared properties feature provides a simple way to
    declare and implement an object’s accessor methods.

    You should definitely read the introduction documentation here:

    http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjectiveC/Chapters/ocProperties.html

    Properties wrap up a bunch of common pattern in tried-and-true ways.

    For example, consider someone’s (naive) potential implementation of a setter method which automatically retains the value assigned to it:

    - (void) setSomeIvar:(SomeObject *)value
    {
         [ivarValue release];
         ivarValue = [value retain];
    }
    

    This seems OK upon first glance, but consider the following code snippet:

    1: SomeObject * foo = [SomeObject new];
    2: [bar setSomeIvar:foo];
    3: [foo release];
    ...
    

    (later, potentially in some other method, where foo is the same foo as above):

    4: [bar setSomeIvar:foo];
    

    What would happen here? Well, in line 1, the retain count is +1, in line 2, it’s +2, line 3, +1, then, later, in line 4, we inadvertently released the object before we assigned it to the ivar and retained it, so this code would error on that line.

    The more-correct code would be something like:

    - (void) setSomeIvar:(SomeObject *)value
    {
         if (ivarValue == value) return;
         [ivarValue release];
         ivarValue = [value retain];
    }
    

    However, the patterns move beyond even this simplistic example.

    So, properties are super convenient, and wrap up all this complexity into something more reliable and readable than otherwise possible.

    They also make it much easier to make sure you’re releasing everything you’re supposed to be in your dealloc method. Simply look at the header file for all properties marked (…retain…) and make sure they’re getting released in the dealloc. Also, for UIViewControllers in particular, and their subclasses, any retained properties marked with IBOutlet should be set to nil in viewDidUnload.

    When I first started using Objective-C I didn’t really use properties – and I suffered for it. Once I understood them and started using them they made my life MUCH easier.

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

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to select an H1 element which is the second-child in its group
I have a text area in my form which accepts all possible characters from

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.