I used this guide: http://www.bdunagan.com/2009/06/28/custom-uitableviewcell-from-a-xib-in-interface-builder to be able to create my own custom UITableViewCell with a nice backg
Use Option B. Either fully use your own custom cell, or fully use Apple's styled cell. Trying to mix and match is not forward compatible.
If you want a convenient property for the detailTextLabel, subclass UITableViewCell
and return the UILabel
you create in the nib. Give it a different name than detailTextLabel
.
If you want to use detailTextLabel in a custom button, follow these steps:
// MYTableViewCell.h:
@interface MYTableViewCell : UITableViewCell
@end
// MYTableViewCell.m
@interface MYTableViewCell ()
@property (nonatomic, weak) IBOutlet UILabel* detailLabel;
@end
-detailTextLabel
@implementation MYTableViewCell
- (UILabel*)detailTextLabel
{
return self.detailLabel;
}
@end
Set the custom class for your tableview cell to be MYTableViewCell and associate your UILabel with your new IBOutlet. Future calls to detailTextView on your tableview cell will now correctly return the proper text view. In this way, you can mix custom and OS provided tableview cells without worrying about the detailTextView.