Sam*_*Sam 7 ipad uisplitviewcontroller uiinterfaceorientation
我在拆分视图的主窗格中使用了UISplitViewController一个UITabBarController带有plain 的内部,在详细信息窗格中使用了一个plain ,它本身包含一个vanilla .UIViewControllerUINavigationControllerUIViewController
我知道Apple建议仅在根级别使用拆分视图,但是我已经看到其他应用程序(例如,亚马逊 - "愿望清单"选项卡)在选项卡中使用拆分视图,因此我确信这是可能的.
我的问题是分割视图的委托方法,即.那些UISplitViewControllerDelegate没有被调用,这阻止我在切换到纵向模式时创建我的弹出菜单.
有问题的方法如下 -
// Called when a button should be added to a toolbar for a hidden view controller
- (void)splitViewController: (UISplitViewController*)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem*)barButtonItem forPopoverController: (UIPopoverController*)pc;
// Called when the view is shown again in the split view, invalidating the button and popover controller
- (void)splitViewController: (UISplitViewController*)svc willShowViewController:(UIViewController *)aViewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem;
// Called when the view controller is shown in a popover so the delegate can take action like hiding other popovers.
- (void)splitViewController: (UISplitViewController*)svc popoverController: (UIPopoverController*)pc willPresentViewController:(UIViewController *)aViewController;
Run Code Online (Sandbox Code Playgroud)
该UISplitViewController 确实收到旋转通知.
我可以得到willShowViewController如果我在应用程序启动的开始强制状态栏方向为横向右(或左)被调用的方法,使用
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight];
Run Code Online (Sandbox Code Playgroud)
但是,willHideViewController不会被调用.而且我不想强迫应用程序从横向开始.如果我做同样的事情但强迫它画像,我不会收到回调.
我不明白为什么拆分视图控制器在行为正常时不会调用它的委托方法.应从其方法中调用这些方法 -
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
Run Code Online (Sandbox Code Playgroud)
在内部,当我在其中断点时,我可以检查委托是否已设置并且它仍处于活动状态.
一整天都被困在这!其他一切都很好用,我很高兴splitview/tabbar/navbar组合运行良好.我只需要这些通知.
我可能只是在旋转时手动调用它们吗?当`UISplitViewController'应该这样做时,似乎非常错误.
| 归档时间: |
|
| 查看次数: |
10529 次 |
| 最近记录: |