iphone窗口传值

比如有view1和view2
view1的init内
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(notificationFunc:) name:NOTIFY_FUNC_DEMO object:nil];
这个用来注册一个接收NOTIFY_FUNC_DEMO消息的处理函数notificationFunc

同时view1内要存在一个方法
- (void) notificationFunc:(NSNotification*)note {
    id notifyObject = [note object];
}

在view2内可以用这个方法来发送消息
[[NSNotificationCenter defaultCenter] postNotificationName: NOTIFY_FUNC_DEMO object:notifyObject];

因此可以用object的部分来传递你要的信息了.

希望能看懂

原文地址:https://www.cnblogs.com/zzxap/p/2175663.html