[英]Override UITableViewCell initialized from xib file
I want change some things (hidden a UITextView, change Font color) dinamically when initialize my custom UITableViewCell (from xib file), but initWithStyle selector isn't called. 我想在初始化我的自定义UITableViewCell(来自xib文件)时改变一些东西(隐藏UITextView,更改字体颜色),但是不调用initWithStyle选择器。
My code below: 我的代码如下:
GoalTableCell.h GoalTableCell.h
@interface GoalTableCell : UITableViewCell
@property (strong, nonatomic) IBOutlet UILabel *fixedText;
@property (strong, nonatomic) IBOutlet UITextView *editableText;
@property (strong, nonatomic) IBOutlet UIImageView *imageCircle;
@end
GoalTableCell.m GoalTableCell.m
@implementation GoalTableCell
- (void) setup
{
self.editableText.hidden = TRUE;
}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
if( self = [super initWithStyle:style reuseIdentifier:reuseIdentifier] ) {
[self setup];
}
return self;
}
@end
When any instance is unarchived from a NIB file the 'initWithCoder: method will be called because the archived properties are provided to the instance via the
decoder` parameter. 当从NIB文件中取消归档任何实例时,
method will be called because the archived properties are provided to the instance via the
'initWithCoder: method will be called because the archived properties are provided to the instance via the
decoder`参数method will be called because the archived properties are provided to the instance via the
。
When instances are loaded from a NIB the awakeFromNib
method is also called. 当从NIB加载实例时,也会调用
awakeFromNib
方法。
initWithCoder: is called to create the instance.
initWithCoder:
is called to create the instance.
awakeFromNib` is called after the instance has been fully unarchived (outlets are connected) from the NIB. 在实例从NIB完全取消归档(连接出口)后调用awakeFromNib`。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.