UITableView background customization strange behavior
There is a couple of hours that I'm trying to set a tableView background image. My controller is a subclass of UITableViewController, and I simply wrote this lines of code in ViewDidLoad method.
UIImage *image = [UIImage imageNamed:@"home-portrait-iphone.png"];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
self.开发者_JS百科tableView.backgroundView = imageView;
Everything looks great on the simulator, I mean, I see my table and as background view, y can see the image. But when the app is running on the device (ipod touch), I get this error:
Program received signal: “SIGABRT”.
and the stack says:
* -[UITableView setBackgroundView:]: unrecognized selector sent to instance 0x812e00 * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UITableView setBackgroundView:]: unrecognized selector sent to instance 0x812e00'
and the exception is thrown in the assignment, a mean this line:
self.tableView.backgroundView = imageView;
any ideas?
Thank you in advance.
The backgroundView
property is new in iPhone OS 3.2. Your iPod touch runs a OS version lower than 3.2.
The backgroundView
property of UITableView
is only available in iPhone OS 3.2 and later. If your iPod isn't running 3.2 (the iPad OS), which it isn't, or one of the 4.0 betas, you won't be able to use that property.
精彩评论