gpt4 book ai didi

iphone - 模态视图 Controller 无法在横向模式下启动

转载 作者:行者123 更新时间:2023-12-03 18:41:57 25 4
gpt4 key购买 nike

我有一个基于导航的应用程序,它有一个详细 View (UIWebView),在 UIToolbar 的底部带有操作按钮。我想在按下“注释”按钮时添加“注释”。当 WebView 处于纵向模式时,一切正常。我按下注释按钮,模态视图可以正常打开并且运行良好。

当 webview 处于横向模式时会出现此问题。如果我按下注释按钮,打开模态视图的所有代码都会被调用,但我得到的只是一个白屏。一条评论:如果我以纵向打开模态视图,然后旋转设备,它会很好地旋转到横向模式。它只是无法在横向模式下正确打开

我有另一个按钮可以打开具有相同行为的邮件编辑器。这是我的 UIWebViewController 中的代码:

- (IBAction)addNotes:(id)sender 
{
NotesViewController *notesViewController;

// create the view controller and set it as the root view of a new navigation
// controller

notesViewController = [[NotesViewController alloc] initWithPrimaryKey:self.record.primaryKey];
UINavigationController *newNavigationController =
[[UINavigationController alloc] initWithRootViewController:notesViewController];

// present the navigation controller modally

[self presentModalViewController:newNavigationController animated:YES];
[notesViewController release];
[self.view setNeedsDisplay]; // not sure if I need this! I was trying different things...
[self.devotionText setNeedsDisplay]; // ditto...
[newNavigationController release];
}

有什么想法吗?我尝试了各种不同的方法都无济于事。我只是看到一个没有导航栏的白屏(尽管顶部有一个状态栏)。

最佳答案

模态框并不总是获取有关旋转的信息,它们从状态栏获取信息,这并不总是能正常工作。将其放入您的 viewWillAppear 中进行修复: [UIApplication sharedApplication].statusBarOrientation = self.interfaceOrientation 并且,如果您希望在模式中添加导航 Controller ,则需要创建一个。

此外,您不需要 setNeedsDisplay。这只会影响当前 View ,不会影响您所呈现的模式。

关于iphone - 模态视图 Controller 无法在横向模式下启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3772016/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com