**.h
IBOutlet UITableView *Table;
NSMutableArray *Currency;
NSArray *Datacell;
** カスタム配列を作成
Custom *usd = [Custom new];
usd.name = @"USD";
usd.detail = @"United States Dollar";
usd.imageFile = @"usd.jpg";
Custom *eur = [Custom new];
eur.name = @"EUR";
eur.detail = @"Euro Member Countries";
eur.imageFile = @"eur.jpg";
Custom *aud = [Custom new];
aud.name = @"AUD";
aud.detail = @"Australia Dollar";
aud.imageFile = @"AUD.jpg";
Currency = [NSArray arrayWithObjects:usd,eur,aud, nil];
テーブル ビューの編集をサポートするためにオーバーライドします。**
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the row from the data source
[Currency removeObjectAtIndex:indexPath.row];
[Table reloadData];
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
else if (editingStyle == UITableViewCellEditingStyleInsert) {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
クラッシュ:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI removeObjectAtIndex:]: unrecognized selector sent to instance 0x682a0c0'