// 监听通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveCartDataChangedNotification:) name:@"CartDataChangedNotification" object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveAlipayResultNotification:) name:@"AlipayResultNotification" object:nil];
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
/// 接收到购物车数据改变
- (void)receiveCartDataChangedNotification:(NSNotification *)notification {
self.cartDataChanged = YES;
}
- (void)receiveAlipayResultNotification:(NSNotification *)notification {
[self handleAlipayResult:notification.userInfo];
}
// 通知购物车数据已改变
[[NSNotificationCenter defaultCenter] postNotificationName:@"CartDataChangedNotification" object:self];
[[NSNotificationCenter defaultCenter] postNotificationName:@"AlipayResultNotification" object:self userInfo:resultDic];