[[NSNotificationCenter defaultCenter]postNotificationName:@"people" object:[self.listdata objectAtIndex:indexPath.row]]//给要传的值写个名字如:@“people”
接收: [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(showvalue1:) name:@"people" object:nil];//需要一个showvalue1:方法得到具体的值:
-(void) showvalue1:(NSNotification *)notification
{
NSString *text=notification.object;
m_labelpeople.text=text;//编辑lable
}
注:不要将[self.navigationController
pushViewController: animated:true]
和[[NSNotificationCenter defaultCenter]postNotificationName:@"people" object:[self.listdata objectAtIndex:indexPath.row]]//这两个动作写在同一个函数中的,最后只有随机一个动作其作用。
NSNotification 通知
猜你喜欢
转载自cydd.iteye.com/blog/2147912
今日推荐
周排行