开发者

Is there a list of Notification names you can use with NSNotificationCenter?

Let me start with my question and then explain what I'm trying to do in case people don't understand the question.

I want to use the Notification Center to catch an event from a UITabBarController. I'm trying to determine when the tab has been changed. In the documentation I can see that I can get that event if I use a delegate. However, I have two separate view controllers in my TabBarController and both need to know if they are active. Is there some way to find out if that corresponding event sends out a notification? Should I create my own delegate, and send out the notification myself?

This all started when i decided that my program needed to have a different view depending on the orientation. I've written my program to have a tab bar at the top level with two tabs. One is the program, the other is an "about" window. When I rotate the device I need the view to change in the first tab and the second tab. I managed to get this to work by listening for device notifications that alert you when the device has rotated. I then change the view in the controller based on the orientation. The problem I'm seeing is that both controllers are getting these notifications and I have not found a way for the unselected tab to no longer receive such notifications. My idea was to listen for which tab was selected and then remove the other one from the rotate notifications. That's not working yet.

So, I have no idea if this makes any sense, but curious开发者_如何学Go to see what people say and suggest.

Recap: How do I find out what notifications are available? Should I create a delegate and fire off my own notifications? Is there a better way of swapping your view on rotate?


You can find the UIApplication notifications here.

Also, you can use darwin notifications which you can find here and you can find an example of how to use darwin notifications here.

In addition, don't forget that in apple's documentation you can always check if in a specific class (like this class for example - scroll to the bottom) there are notifications you can register too (like the UIApplication example).

Good luck.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜