Re: initWithNibName:nil not working for UITableViewController?
Re: initWithNibName:nil not working for UITableViewController?
- Subject: Re: initWithNibName:nil not working for UITableViewController?
- From: Jason Foreman <email@hidden>
- Date: Mon, 16 Aug 2010 08:55:05 -0500
Hi Matt,
On Fri, Aug 13, 2010 at 8:45 PM, Matt Neuburg <email@hidden> wrote:
> But I had expected initWithNibName: to follow the rule documented under
> UIViewController:
>
> "If you specify nil for the nibName parameter and do not override the
> loadView method in your custom subclass, the default view controller
> behavior is to look for a nib file whose name (without the .nib extension)
> matches the name of your view controller class. If it finds one, the class
> name becomes the value of the nibName property, which results in the
> corresponding nib file being associated with this view controller."
>
> Is this a bug? I've made a small demonstration project that I can easily
> send in via bugreporter, if so. m.
>
If you review the docs for UITableViewController, you'll see that it changes
the standard behavior of a nil nibName argument and instead creates a basic,
unconfigured table:
"If a nib file is specified via the initWithNibName:bundle: method (which is
declared by the superclass
UIViewController<file:///Library/Developer/Shared/Documentation/DocSets/com.apple.adc.documentation.AppleiPhone3_2.iPhoneLibrary.docset/Contents/Resources/Documents/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/cl/UIViewController>
),UITableViewController loads the table view archived in the nib file.
Otherwise, it creates an unconfigured
UITableView<file:///Library/Developer/Shared/Documentation/DocSets/com.apple.adc.documentation.AppleiPhone3_2.iPhoneLibrary.docset/Contents/Resources/Documents/documentation/UIKit/Reference/UITableView_Class/Reference/Reference.html#//apple_ref/occ/cl/UITableView>
object
with the correct dimensions and autoresize mask. You can access this view
through the tableView<file:///Library/Developer/Shared/Documentation/DocSets/com.apple.adc.documentation.AppleiPhone3_2.iPhoneLibrary.docset/Contents/Resources/Documents/documentation/UIKit/Reference/UITableViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UITableViewController/tableView>
property."
This bit me once as well. I consider it a poor API design choice to change
the behavior so drastically from UIViewController, but it is almost certain
not to change at this point.
Jason
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden