I know it was a long time ago but you should create a delegate on the second view.
@protocol ExpenseProtocol;
@interface NewExpenseViewController : UIViewController
@property (nonatomic, weak) id<ExpenseProtocol> *delegate;
@end
@protocol ExpenseProtocol <NSObject>
- (void)didCreateNewExpense:(Expense)newExpense;
@end
@implementation NewExpenseViewController
- (void)savePressed:(id)sender {
if (self.delegate && [self.delegate responseToSelector:@selector(didCreateNewExpense:)]) {
[self.delegate didCreateNewExpense:_newExpense];
}
}
@end
Then in your first view controller
@interface ListExpenseViewController () <ExpenseProtocol>
@end
@implementation ListExpenseViewController
- (void)didCreateNewExpense:(Expense)newExpense {
if (newExpense) {
[_arrayExpense addObject:newExpense];
}
[self.tableView reloadData];
}
@end