ios – 在MailComposer被解散后,StatusBar位于navigationBar之上

ios – 在MailComposer被解散后,StatusBar位于navigationBar之上,第1张

概述问题:我出现后,我的状态栏显示在navigationBar的顶部,并将MFMailComposerViewController作为模态视图关闭. -(IBAction)openMail:(id)sender{ MFMailComposeViewController *mc = [[MFMailComposeViewController alloc] init]; mc.mailC 问题:我出现后,我的状态栏显示在navigationbar的顶部,并将MFMailComposerVIEwController作为模态视图关闭.

-(IBAction)openMail:(ID)sender{    MFMailComposeVIEwController *mc = [[MFMailComposeVIEwController alloc] init];    mc.mailComposeDelegate = self;    [mc setSubject:emailTitle];    [mc setMessageBody:messageBody isHTML:YES];    [mc setToRecipIEnts:toRecipents];    [mc.navigationItem.leftbarbuttonItem setTintcolor:[UIcolor colorWithRed:144/255.0f green:5/255.0f blue:5/255.0f Alpha:1.0f]];    [self presentVIEwController:mc animated:YES completion:NulL];}- (voID) mailComposeController:(MFMailComposeVIEwController *)controller dIDFinishWithResult:(MFMailComposeResult)result error:(NSError *)error{switch (result){    case MFMailComposeResultCancelled:        NSLog(@"Mail cancelled");        break;    case MFMailComposeResultSaved:        NSLog(@"Mail saved");        break;    case MFMailComposeResultSent:        NSLog(@"Mail sent");        break;    case MFMailComposeResultFailed:        NSLog(@"Mail sent failure: %@",[error localizedDescription]);        break;    default:        break;}// reset background image for navigation bars[[UINavigationbar appearance] setBackgroundImage:[UIImage imagenamed:@"navigationbar.png"] forbarMetrics:UIbarMetricsDefault];NSLog(@"%@",[GGStackPanel printFrameParams:self.vIEw]);// Close the Mail InterfaceGGAppDelegate * appDel = [[UIApplication sharedApplication] delegate];HHTabListController * contr = (HHTabListController*)appDel.vIEwController;[contr setWantsFullScreenLayout:NO];NSLog(@"%i",[contr wantsFullScreenLayout]);[self dismissVIEwControllerAnimated:YES completion:NulL];}

Stackoverflow上有几个类似的问题,但没有一个解决方案表明它对我有用.
我已经尝试过了:

status bar and Navigation bar problem after dismissed modal view

http://developer.appcelerator.com/question/120577/nav-bar-appears-underneath-status-bar

我尝试从AppDelegate提出并解雇,没有任何帮助.

更改视图框架或navigationbar框架是可行的,但我必须对我的应用程序中的所有其他视图执行相同的 *** 作(其中有许多视图).这将使我的整个应用程序依赖于这个小错误.

请不要低估这个问题,因为有类似的问题.我非常绝望,这个问题让我烦恼了3天.

截图

View before presenting http://imageshack.us/a/img801/8946/beforet.png

解雇MailComposer后:

View after dismissing http://imageshack.us/a/img507/8940/afterb.png

解决方法 wantFullScreenLayout是复杂且无关的东西.所有的vIEwcontrollers都需要嵌入到“layout”视图控制器(Apples UINavigationController,Apple的UITabbarController)中,或者完全实现“我应该有多大,我在哪里定位?”的复杂逻辑.他们自己.

Apple决定使用iOS 1.0,你看到的主要iPhone视图不会从0,0开始.包含它的窗口从(0,0)开始,但状态栏显示为OVERLAPPED.

我认为这是他们后悔的决定,当时有道理,但从长远来看,它会造成很多错误.

净效果是:

> UINavigationController和UITabbarController有特殊的(未记录的)内部代码,使得SEEM AS IF(0,0)是左上角 – 它们强制调整大小/重新定位你添加到它们的任何UIVIEwController
> …如果您不使用其中一个作为主控制器,则必须自己重新实现该逻辑.如果您正在使用第三方UIVIEwController实例,则逻辑通常会被错误地实现或丢失.
> …你可以在运行时通过重新定位UIVIEwController.vIEw(它的根视图)来自己修复它,例如,这样:

(码)

UIVIEwController* rootController = // in this case HHTabController?UIVIEw* rootVIEw = rootController.vIEw;CGRect frame = rootVIEw.frame;CGPoint oldOrigin = frame.origin;CGPoint newOrigin = // calculate this,according to Apple docs.// in your current case,it should be: CGPointMake( 0,20 );frame.origin = newOrigin;frame.size = CGSizeMake( frame.size.wIDth - (newOrigin.x - oldOrigin.x),frame.size.height - (newOrigin.y - oldOrigin.y) );rootVIEw.frame = frame;

……很明显,每次都要这样做很烦人.这就是为什么Apple强烈鼓励每个人使用UINavigationController和/或UITabbarController 总结

以上是内存溢出为你收集整理的ios – 在MailComposer被解散后,StatusBar位于navigationBar之上全部内容,希望文章能够帮你解决ios – 在MailComposer被解散后,StatusBar位于navigationBar之上所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1039791.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-24
下一篇 2022-05-24

发表评论

登录后才能评论

评论列表(0条)

保存