Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 iPad 应用程序,其中包含许多视图控制器,它们都以编程方式从一个 mainViewcontroller 加载。当方向从纵向变为横向时,我会更改一些 UI。到目前为止,我一直在 mainVC 中处理该通知。我的问题是:Objective C 如何处理通知生成过程?它是否从 mainVC 开始,然后向下渗透到子 UIControls?我应该观察所有视图控制器中的 UIInterfaceOrientation 变化,还是只观察主要的?
主VC应该负责轮换事件的管理。我通常以这种方式工作。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
是提供有关设备方向更改通知的代表。我认为您可以在所有视图控制器中实现这一点。
但还要注意它是特定于视图控制器的,它不依赖于父级