initWithNibName:nil not working for UITableViewController?
initWithNibName:nil not working for UITableViewController?
- Subject: initWithNibName:nil not working for UITableViewController?
- From: Matt Neuburg <email@hidden>
- Date: Fri, 13 Aug 2010 18:45:20 -0700
- Thread-topic: initWithNibName:nil not working for UITableViewController?
I asked for a new file which was a UITableViewController along with the
corresponding nib file. But when I instantiated my controller and presented
it, the table was not taking on any of the characteristics I was specifying
in the nib file. After some experimentation (subtext: this took all day to
figure out), it turned out that this was because initWithNibName: was not
behaving the way I expected. I was saying this:
TableViewController* tvc =
[[TableViewController alloc] initWithNibName:nil bundle:nil];
I changed it to this:
TableViewController* tvc =
[[TableViewController alloc] initWithNibName:@"TableViewController"
bundle:nil];
And presto, everything worked fine.
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."
But clearly that's not the behavior I was getting; instead, I had to specify
the nib name explicitly, even though its name was the same as the name of
the class.
Is this a bug? I've made a small demonstration project that I can easily
send in via bugreporter, if so. m.
--
matt neuburg, phd = email@hidden, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
AppleScript: the Definitive Guide, 2nd edition
http://www.tidbits.com/matt/default.html#applescriptthings
Take Control of Exploring & Customizing Snow Leopard
http://tinyurl.com/kufyy8
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.com
_______________________________________________
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