应用程序崩溃。
我添加了自定义单元格。当滚动应用程序崩溃并出现错误时:
“UIView setTableViewStyle 无法识别的选择器发送到实例 XXXXXX”
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if(tableView==tableviewDetail)
{
static NSString *CellIdentifier_1 = @"Cell";
CustomCASADetailCell *cell = (CustomCASADetailCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier_1];
if (cell == nil)
{
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"CustomCASADetailCell" owner:self options:nil];
cell = [topLevelObjects objectAtIndex:0];
if([strCallingView isEqualToString:@"CreditCard"])
{
if ([indexPath row] % 2==0)
cell.contentView.backgroundColor=[UIColor whiteColor] ;
else
cell.contentView.backgroundColor =[UIColor colorWithRed:205.0f/255.0f green:201.0f/255.0f blue:201.0f/255.0f alpha:0.6f];
}
else
{
if ([indexPath row] % 2==0)
cell.contentView.backgroundColor=[UIColor whiteColor] ;
else
cell.contentView.backgroundColor =[UIColor colorWithRed:255.0f/255.0f green:239.0f/255.0f blue:213.0f/255.0f alpha:0.6f];
}
}
NSArray *toplavelobject=[[NSBundle mainBundle]loadNibNamed:@"CustomCASADetailCell" owner:self options:nil];
for(id c in toplavelobject)
{
if ([c isKindOfClass:[UITableViewCell class]])
{
cell=(CustomCASADetailCell *) c;
break;
}
}
if([strCallingView isEqualToString:@"CreditCard"])
{
if([maCreditCardDetailKey count]>0 && [maCreditCardDetailValue count]>0)
{
cell.lblName.text=[maCreditCardDetailKey objectAtIndex:indexPath.row];
cell.lblDescription.text=[maCreditCardDetailValue objectAtIndex:indexPath.row ];
}
}
else if([strCallingView isEqualToString:@"Account"])
{
if([maAccountDetailKey count]>0 && [maAccountDetailValue count]>0)
{
cell.lblName.text=[maAccountDetailKey objectAtIndex:indexPath.row];
cell.lblDescription.text=[maAccountDetailValue objectAtIndex:indexPath.row ];
}
}
return cell;
}
else if(tableView==tableviewMiniStatement)
{
static NSString *CellIdentifier_2 = @"Cell";
MinistatementTableCell *cell = (MinistatementTableCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier_2];
if (cell == nil)
{
cell = [[MinistatementTableCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"] ;
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"MinistatementTableCell" owner:self options:nil];
cell = [topLevelObjects objectAtIndex:0];
}
cell.lblDescription.adjustsFontSizeToFitWidth=NO;
cell.lblDescription.numberOfLines=4;
cell.lblDescription.lineBreakMode=UILineBreakModeWordWrap;
MiniStatement *objMiniStatement=[[MiniStatement alloc]init];
if([marrAccountMinistatement count]>0)
{
if (tableView.tag==0)
{
objMiniStatement=[marrAccountMinistatement objectAtIndex:indexPath.row];
}
else
{
objMiniStatement=[marrAccountMinistatement objectAtIndex:((tableView.tag*5)+indexPath.row)];
}
cell.lblTransactionDate.text=objMiniStatement.strATAccountPostDate;//set transaction date here
cell.lblValueDate.text=objMiniStatement.strATAccountPostDate ;
cell.lblDescription.text=objMiniStatement.strATNaration;
cell.lblAmount.text=[NSString stringWithFormat:@"%@ %@",lblCurrency.text,objMiniStatement.strATTransactionAmount];
}
}
return cell;
}
else if(tableView==tableviewCCUnbilledTransaction)
{
static NSString *CellIdentifier_3 = @"Cell";
CCUnbilledTransactionCell *cell = (CCUnbilledTransactionCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier_3];
if (cell == nil)
{
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"CCUnbilledTransactionCell" owner:self options:nil];
cell = [topLevelObjects objectAtIndex:0];
}
NSArray *toplavelobject=[[NSBundle mainBundle]loadNibNamed:@"CCUnbilledTransactionCell" owner:self options:nil];
for(id c in toplavelobject)
{
if ([c isKindOfClass:[UITableViewCell class]])
{
cell=(CCUnbilledTransactionCell *) c;
break;
}
}
cell.lblDescription.adjustsFontSizeToFitWidth=NO;
cell.lblDescription.numberOfLines=4;
cell.lblDescription.lineBreakMode=UILineBreakModeWordWrap;
CardMiniStatement *objCardMiniStatement=[[CardMiniStatement alloc]init];
if([marrCCUnbilledTransactionRecordShown count]>0)
{
if (tableView.tag==0)
{
objCardMiniStatement=[marrCCUnbilledTransactionRecordShown objectAtIndex:indexPath.row];
}
else
{
objCardMiniStatement=[marrCCUnbilledTransactionRecordShown objectAtIndex:((tableView.tag*5)+indexPath.row)];//Sarita 28May
}
if(objCardMiniStatement!=nil)
{
cell.lblCreditCardNo.text=[FormatData FormatCreditCardNumber:objCardMiniStatement.strCardNumber];
cell.lblTransactionDate.text=objCardMiniStatement.strTransactionDate ;
cell.lblPostDate.text=objCardMiniStatement.strPostDate;
cell.lblDescription.text=objCardMiniStatement.strTransactionDetail;
cell.lblAmount.text=objCardMiniStatement.strTransactionAmount;
}
}
return cell;
}
}