【发布时间】:2013-04-05 14:27:17
【问题描述】:
问题:在我将MFMailComposerViewController 显示为模态视图并将其关闭后,我的状态栏出现在navigationBar 的顶部。
-(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 呈现和关闭,没有帮助。
更改视图框架或导航栏框架有效,但我必须对我的应用程序中的所有其他视图执行相同的操作(其中有很多)。这将使我的整个应用程序依赖于这个小错误。
截图
关闭 MailComposer 后:
【问题讨论】:
-
可以发截图吗?
-
MailComposer 是否全屏显示?
-
我不这么认为。我检查了 self.wantsFullScreenLayout 的值,它是 NO。我尝试使用 self.wantsFullScreenLayout,甚至尝试更改 appDelegate.viewController 和 MailComposer 的 WantsFullScreenLayout 属性 --> 没有变化。
-
您的主 ViewController 的布局逻辑似乎不正确。什么是“HHTabListController”?
-
我使用 HHTabListController 作为超级 viewController。我想要一个垂直的 tabBar,就像 Facebook 应用一样。所以我发现its close implementation here 我想也许如果我将 hhTabListController 的 wantFullScreenLayout 设置为 NO 可以解决问题,但显然它没有。
标签: ios objective-c user-interface uinavigationbar statusbar