HTML5   发布时间:2022-04-27  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ios – 在MailComposer被解散后,StatusBar位于navigationBar之上大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
问题:我出现后,我的状态栏显示在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 Interface
GGAppDelegate * 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

本图文内容来源于网友网络收集整理提供,作为学习参使用,版权属于原作者。
@H_874_55@

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

大佬总结

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

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

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。