在iOS6中正常工作但在iOS5中不工作的自定义表格单元格
我有一个自定义的表单元格,它在iOS6中运行良好 在iOS5中,当带有表的屏幕被导航到错误时,应用程序崩溃在iOS6中正常工作但在iOS5中不工作的自定义表格单元格,ios,uitableview,Ios,Uitableview,我有一个自定义的表单元格,它在iOS6中运行良好 在iOS5中,当带有表的屏幕被导航到错误时,应用程序崩溃 *** Assertion failure in -[ThemedTableView _createPreparedCellForGlobalRow:withIndexPath:], /SourceCache/UIKit_Sim/UIKit-1912.3/UITableView.m:6072 下一行 self.titleLabel.shadowOffset = CGSizeMake(
*** Assertion failure in -[ThemedTableView _createPreparedCellForGlobalRow:withIndexPath:], /SourceCache/UIKit_Sim/UIKit-1912.3/UITableView.m:6072
下一行
self.titleLabel.shadowOffset = CGSizeMake(0.0, 1.0);
在其中一个表格单元格使用的自定义UIButton的awakeFromNib方法中
在iOS5中,CellForRowatineXpath中创建的一个单元格似乎返回了nil,而诸如-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString*)reuseIdentifier和awakeFromNib等自定义单元格的方法都没有被调用
在我使用的tableview控制器中
nib = [UINib nibWithNibName:@"AboutYouTextFieldQuestionCell" bundle:nil];
[[self tableView] registerNib:nib forCellReuseIdentifier:kTextFieldQuestionCell];
下面是用于创建单元格的代码
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSDictionary *questionDict = [self.questions objectAtIndex:indexPath.section];
NSString *questionType = [questionDict objectForKey:@"questiontype"];
if ([questionType isEqualToString:@"textfield"])
{
AboutYouTextFieldQuestionCell *textCell = [tableView dequeueReusableCellWithIdentifier:kTextFieldQuestionCell];
textCell.backgroundColor = [UIColor whiteColor];
textCell.delegate = self;
NSArray *answersArray = [questionDict objectForKey:@"answers"];
NSDictionary *questionDictionary = [answersArray objectAtIndex:indexPath.row];
textCell.questionlLabel.text = [questionDictionary objectForKey:@"questiontitle"];
NSString *keyString = [questionDictionary objectForKey:@"questionkey"];
if ([self.aboutYouAnswers objectForKey:keyString]) {
textCell.tf.text = [[self.aboutYouAnswers objectForKey:keyString] stringValue];
} else {
textCell.tf.text = nil;
}
return textCell;
}
....
请格式化你的代码。还提供用于创建单元格的代码。您是否使用标识符为:forIndexPath:的可重用单元出列?谢谢Borrden,没有,我刚刚添加了用于创建单元格的代码。如果questionType为!=textfield?您是否正在使用注册表类:forCellReuseIdentifier:?