I just installed iPhone SDK 3.0 and found that the text property of UITableViewCell is not used anymore, and should use textLabel.text instead. Does this mean that I have to know the current system version and call the corresponding method? like this.
UITableViewCell *cell = ...;
if ([[[UIDevice currentDevice] systemVersion] isEqualToString:@"3.0"]) {
cell.textLabel.text = @"...";
} else {
cell.text = @"...";
}
If so, that would be very annoying.
Instead of checking the OS version, you can check if the cell has the new property:
if ([cell respondsToSelector:@selector(textLabel)]) {
// Do it the 3.0 way
cell.textLabel.text = @"...";
} else {
// Do it the 2.2 way, but avoid deprecation warning
[cell performSelector:@selector(setText:) withObject:@"..."];
}
Just build for 3.0 and don't worry about 2.2 anymore. Unlike major OS upgrades, people have been upgrading to new version of iPhone OS very, very quickly. Check out this post on the TapBots blog: iPhone 3.0 Adoption Rate.
By the time your app gets approved (2 weeks from now + some?) almost nobody will be using 2.2 anymore!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With