我正在尝试将我的自定义对象插入BalanceData
,NSMutableArray
但出现错误:
No known class method for selector 'balnce'
我的代码:
- (void)insertNewObject:(id)sender
{
if (!_balances) {
_balances = [[NSMutableArray alloc] init];
}
[_balances insertObject:[BalanceData balance] atIndex:0]; // error occures here
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
[self.tableView insertRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
}
MasterViewController.m
最佳:
#import "MasterViewController.h"
#import "DetailViewController.h"
#import "BalanceData.h"
@interface MasterViewController () {
NSMutableArray *_balances;
}
@end
@implementation MasterViewController
@synthesize balances = _balances;
我怎样才能以正确的方式做到这一点?