
我的问题是:我从我的主VIEwController呈现VIEwController,如下所示:
UINavigationController *navigation = [[UINavigationController alloc] initWithRootVIEwController:VController];navigation.TransitioningDelegate = self;navigation.modalPresentationStyle = UIModalPresentationCustom;[self presentVIEwController:navigation animated:YES completion:nil];
每当iPhone用户正在通话中,或者正在使用他或她的手机作为热点时,状态栏会被放大,将我的模态显示VC推到底部,但原点设置为(0; 0)
问题是当用户在我的应用程序状态栏中调整大小到正常大小时完成调用,但Modal VC没有向上移动.
由于此通知,我在代码中发现时就知道了这一点:
[[NSNotificationCenter defaultCenter] addobserver:self selector:@selector(statubarChange:) name:UIApplicationDIDChangeStatusbarFrameNotification object:nil];
最糟糕的是框架是核心,原点仍然是(0,0)
有没有办法反映模态提出的vc?没有解雇并再次提出它?
解决方法 你真的需要这种模式的自定义过渡吗?如果没有,删除行“navigation.modalPresentationStyle = UIModalPresentationCustom”,你就可以了.如果确实需要自定义样式,这是iOS 8中状态栏中UIModalPresentationCustom样式的已知错误. AFAIK,你必须使用animateTransition来破解它并将框架推到适当的位置.
在下面的app委托中使用willChangeStatusbarFrame还有一个非常糟糕的黑客攻击.您可以通过检测是否实际存在模态以及动画更改来改进它.
- (voID)application:(UIApplication *)application willChangeStatusbarFrame:(CGRect)newStatusbarFrame{ if (newStatusbarFrame.size.height < 40) { for (UIVIEw *vIEw in self.window.subvIEws) { vIEw.frame = self.window.bounds; } }} 另一种方法是使模态覆盖状态栏,并覆盖该视图控制器的prefeRSStatusbarHIDden.
我讨厌所有这些解决方案,但它应该根据项目的设置方式给你一些可行的东西,如果你不能忽略那个临时模态对话框的小空间.
总结以上是内存溢出为你收集整理的iOS in-call状态栏更新viewcontroller在屏幕上呈现modaly全部内容,希望文章能够帮你解决iOS in-call状态栏更新viewcontroller在屏幕上呈现modaly所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)