gpt4 book ai didi

iphone - 模态视图 Controller 出现在操作表后面

转载 作者:行者123 更新时间:2023-12-03 20:34:59 25 4
gpt4 key购买 nike

我的模态视图 Controller 显示在 UIActionSheet 后面,并且我的 UIActionSheet 没有被忽略。我正在使用:

[self presentModalViewController:composeTweetView animated:YES];

展示我的模态视图 Controller 。

我的操作表正在从 tabBar 显示:

[actionSheet showFromTabBar:self.parentViewController.tabBarController.tabBar];

此代码适用于 iOS 4.0。

if (buttonIndex == 0) {
if (self.isLoggedIn) {
[FlurryAPI logEvent:@"ST_REPLY_CLICKED"];
composeTweetView.isDirectMessage = FALSE;
[self presentModalViewController:composeTweetView animated:YES];
[composeTweetView release];
}
else {
LoginViewController* loginView = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil];
loginView.delegate = self;
loginView.isPostingComment = TRUE;
self.isReply = TRUE;
[self presentModalViewController:loginView animated:YES];
[loginView release];
[composeTweetView release];
}
}

摘要:

我有一个包含 UITabBar 的 UIViewController。我正在展示一个 UIActionSheet,其中有一些呈现模态视图 Controller 的按钮。当模态视图 Controller 出现时,UIActionSheet 应该自行消失,并且模态视图应该位于堆栈的顶部。问题是,UIActionSheet 不会关闭,模态视图会在其后面加载。这个问题直到iOS 4.2.1才出现

重现步骤:

  1. 创建TabBar项目,设置iOS 4.2.1 的基础 SDK
  2. 创建一个按钮或触发器来显示 UIActionSheet
  3. 允许 UIActionSheet 中的按钮之一使用以下语法呈现模态视图 Controller :[actionSheet showFromTabBar:self.parentViewController.tabBarController.tabBar];

预期结果:

1. The UIActionSheet should dismiss itself, and the modal view should appear in front

实际结果:

1. The UIActionSheet does not get dismissed and the modal view appears behind it.

回归:

This problem was not apparent prior to iOS 4.2.1

注释:我尝试了其他显示 UIActionSheet 的方法,但所有这些方法都无法按预期工作:

//[actionSheet showInView:self.parentViewController.tabBarController.tabBar];
//[actionSheet showInView:[self.view window]];
//[actionSheet showInView:self.parentViewController.tabBarController.view];
//[actionSheet showInView:[UIApplication sharedApplication].keyWindow];

最佳答案

在整理示例以重现您的问题时,我查看了 UIActionSheet 委托(delegate)方法。我相信你可以使用:

actionSheet:didDismissWithButtonIndex:

而不是

actionSheet:clickedButtonAtIndex:

我还没有测试过它,但我相信您仍然会得到相同的按钮编号,并且直到操作表从 View 中消失后才会触发。

关于iphone - 模态视图 Controller 出现在操作表后面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4453391/

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