How can I create a UITableViewCell
like a UITextField
programmatically or using Interface Builder?
I tried with Interface Builder but it seems it doesn't work:
Subclass UITableViewCell and add a UITextField to the cell's contentView. You probably won't get your result without creating your own tableViewCell.
example:
MyAwesomeTextfieldCell.h
@interface MyAwesomeTextfieldCell : UITableViewCell
@property (retain, nonatomic) IBOutlet UITextField *labelTextView;
@end
MyAwesomeTextfieldCell.m
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
_labelTextView = [[UITextField alloc] init];
_labelTextView.backgroundColor = [UIColor clearColor];
_labelTextView.font = [UIFont boldSystemFontOfSize:17.0];
_labelTextView.textColor = [UIColor whiteColor];
[self addSubview:_labelTextView];
}
return self;
}
static NSString * kCellReuse = @"CellReuseIdentifier"
UITableViewCell * cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:kCellReuse];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.