我有custom cell
一个textfield
作为子视图的。将单元格设置为代表是否合法textfield
?
我想将单元格设置为委托,因为它是父视图,但是当我这样做时,应用程序崩溃了。我想这是因为table view dequeue cells
,也许这就是委托参考在两者之间丢失的原因。所以,我尝试设置委托cellForRowAtIndexPath
以确保它每次都是新设置的,但它仍然无法正常工作。
我真的必须提升一个级别并让作为tableview controller
单元格子视图的代表吗?还是我错过了其他东西?
崩溃报告输出:
>libobjc.A.dylib`objc_msgSend:
>
0x32ed4f78: ldr r3, [r4, #8]
>
initWithStyle 我有
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier type: (NSString *)cellType
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
NSArray *nibArray = [[NSBundle mainBundle] loadNibNamed:@"Custom Cell" owner:self options:nil];
self = [nibArray lastObject];
self.cellType = [NSString stringWithString:cellType];
self.contentText.autoresizingMask = UIViewAutoresizingNone;
self.detailLabel.autoresizingMask = UIViewAutoresizingNone;
self.contentText.delegate = self;
}
return self;
}