uitableview をスクロールしてから uitableview の入力配列に新しい項目を追加しようとするとクラッシュする
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
if([selected_table_string isEqualToString:@"table_for_category"])
{
[cell.contentView addSubview:[self tab_label:[NSString stringWithFormat:@"%@",[AppDelegate.category_arr objectAtIndex:indexPath.row]] fram:CGRectMake(10, 3, 200, 25)]];
if([AppDelegate.selected_category_arr_item containsObject:[AppDelegate.category_arr objectAtIndex:indexPath.row ]])
{
[cell.contentView addSubview:[self img_name:@"chk_box_chk.png" frm:CGRectMake(140, 3, 30, 25)]];
}
else
{
[cell.contentView addSubview:[self img_name:@"chk_box.png" frm:CGRectMake(140, 3, 30, 25)]];
}
}
else if ([selected_table_string isEqualToString:@"table_for_shape"])
{
[cell.contentView addSubview:[self tab_label:[NSString stringWithFormat:@"%@",[AppDelegate.shapeNames_arr objectAtIndex:indexPath.row]] fram:CGRectMake(10, 3, 200, 25)]];
if([AppDelegate.selected_shapeNames_arrr_item containsObject:[AppDelegate.shapeNames_arr objectAtIndex:indexPath.row ]])
{
[cell.contentView addSubview:[self img_name:@"chk_box_chk.png" frm:CGRectMake(140, 3, 30, 25)]];
}
else
{
[cell.contentView addSubview:[self img_name:@"chk_box.png" frm:CGRectMake(140, 3, 30, 25)]];
}
}
else if ([selected_table_string isEqualToString:@"table_for_color"])
{
[cell.contentView addSubview:[self tab_label:[NSString stringWithFormat:@"%@",[AppDelegate.color_arr objectAtIndex:indexPath.row]] fram:CGRectMake(10, 3, 200, 25)]];
if([AppDelegate.selected_color_arr_item containsObject:[AppDelegate.color_arr objectAtIndex:indexPath.row ]])
{
[cell.contentView addSubview:[self img_name:@"chk_box_chk.png" frm:CGRectMake(140, 3, 30, 25)]];
}
else
{
[cell.contentView addSubview:[self img_name:@"chk_box.png" frm:CGRectMake(140, 3, 30, 25)]];
}
}
else if ([selected_table_string isEqualToString:@"table_for_purity"])
{
[cell.contentView addSubview:[self tab_label:[NSString stringWithFormat:@"%@",[AppDelegate.purity_arr objectAtIndex:indexPath.row]] fram:CGRectMake(10, 3, 200, 25)]];
if([AppDelegate.selected_purity_arr_item containsObject:[AppDelegate.purity_arr objectAtIndex:indexPath.row ]])
{
[cell.contentView addSubview:[self img_name:@"chk_box_chk.png" frm:CGRectMake(140, 3, 30, 25)]];
}
else
{
[cell.contentView addSubview:[self img_name:@"chk_box.png" frm:CGRectMake(140, 3, 30, 25)]];
}
}
else if ([selected_table_string isEqualToString:@"table_for_Fluo"])
{
[cell.contentView addSubview:[self tab_label:[NSString stringWithFormat:@"%@",[AppDelegate.Fluo_arr objectAtIndex:indexPath.row]] fram:CGRectMake(10, 3, 200, 25)]];
if([AppDelegate.selected_Fluo_arr_item containsObject:[AppDelegate.Fluo_arr objectAtIndex:indexPath.row ]])
{
[cell.contentView addSubview:[self img_name:@"chk_box_chk.png" frm:CGRectMake(140, 3, 30, 25)]];
}
else
{
[cell.contentView addSubview:[self img_name:@"chk_box.png" frm:CGRectMake(140, 3, 30, 25)]];
}
}
else if ([selected_table_string isEqualToString:@"table_for_Cut"])
{
[cell.contentView addSubview:[self tab_label:[NSString stringWithFormat:@"%@",[AppDelegate.cut_arr objectAtIndex:indexPath.row]] fram:CGRectMake(10, 3, 200, 25)]];
if([AppDelegate.selected_cut_arr_item containsObject:[AppDelegate.cut_arr objectAtIndex:indexPath.row ]])
{
[cell.contentView addSubview:[self img_name:@"chk_box_chk.png" frm:CGRectMake(140, 3, 30, 25)]];
}
else
{
[cell.contentView addSubview:[self img_name:@"chk_box.png" frm:CGRectMake(140, 3, 30, 25)]];
}
}
else if ([selected_table_string isEqualToString:@"table_for_myselection"])
{/////IT'S RECIEVED FOR MYSELECTIONS......
//ParcelDetails *obj_parcel_selected_for_mail;
obj_parcel_details_for_mail = [AppDelegate.mySelected objectAtIndex:indexPath.row];
//cell.textLabel.text = [AppDelegate.mySelected objectAtIndex:indexPath.row];
cell.textLabel.text = [NSString stringWithFormat:@"%@",obj_parcel_details_for_mail.parcelId];
cell.textLabel.font = [UIFont fontWithName:@"Tahoma" size:18.0];
UIButton *mail_to_Button = [UIButton buttonWithType:UIButtonTypeCustom];
[mail_to_Button setImage:[UIImage imageNamed:@"mail_icon_9"] forState:UIControlStateNormal];
mail_to_Button.layer.shadowColor = [UIColor grayColor].CGColor;
mail_to_Button.layer.shadowOffset = CGSizeMake(0, 3);
mail_to_Button.layer.shadowOpacity = 1.8;
mail_to_Button.layer.shadowRadius = 10.0;
[mail_to_Button addTarget:self action:@selector(send_mail_Action) forControlEvents:UIControlEventTouchUpInside];
[mail_to_Button setFrame:CGRectMake(530,15,40,40)];
[cell.contentView addSubview:mail_to_Button];
}
return cell;
}