我有一个习惯UITableViewCell
我这样使用:
AppTableCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"AppTableCell" owner:self options:nil];
for(id currentObject in topLevelObjects) {
if([currentObject isKindOfClass:[AppTableCell class]]) {
cell = (AppTableCell *)currentObject;
break;
}
}
}
工作完美。但是,我想在创建单元格时对其进行一些自定义操作。通常我会覆盖类似的东西initWithFrame
,但这里没有使用它。我应该重写什么方法来自定义初始化?
正确的方法是重写 UITableViewCell 的 awakeFromNib 。
- (void)awakeFromNib
{
[super awakeFromNib];
// Do something
}
See 参考 http://developer.apple.com/library/ios/#documentation/UIKit/Reference/NSObject_UIKitAdditions/Introduction/Introduction.html更多细节。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)