Right now, in FirstviewController, I got a button, when i clicked it, I get the value back using delegate. Right now, I want to send this value to SecondViewcontroller and reload it's tableview data. How to do that? How about use nsnotificationcenter, but i have tried, it's not working. I post the notification in the delegate that implemented in Firstviewcontroller. the code like this:
FirstviewController.m
// delegate that get selected cat
- (void)didSelectSubCat:(SubCat *)cat;
{
[[NSNotificationCenter defaultCenter] postNotificationName:@"DidSelectCat" object:self userInfo:@{@"catId": cat.catId}];
}
SecondViewcontroller.m
- (void)awakeFromNib
{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(selectedCat:) name:@"DidSelectCat" object:nil];
}
- (void)selectedCat:(NSNotification *)notif
{
NSLog(@"userinfo: %@", [notif userInfo]);
}