I have a UITableViewController that displays a custom UITableViewCell (inherited from UITableViewCell). That same UITableViewCell has a UILabel that can have text of variable length. The challenge I am having is how to access this UILabel in my UITableViewController so that I can set the correct cell height in heightForRowAtIndexPath.
Or on a side note how do I solve my problem of having a dynamicically sized label.
thanks
Here is my code for the custom UITableViewCell:
header:
#import <UIKit/UIKit.h>
@interface MessagesCustomViewCell : UITableViewCell
@property (nonatomic, weak) IBOutlet UILabel *message; <---- need to access this
@end
implementation:
#import "MessagesCustomViewCell.h"
@implementation MessagesCustomViewCell
@synthesize message=_message;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end