ios - 嵌套推送动画会导致导航栏损坏 PUSH POP PUSH

标签 ios iphone

我有三个 Controller 一二三 .首先是navigationController的rootViewController。

SecondViewController ,我有一个名为 的协议(protocol)SecondViewControllerDelegate 它有一个委托(delegate)方法

@protocol SecondViewControllerDelegate <NSObject>

- (void)doneSucceed:(NSString *)msg;

@end

在 FirstViewController 中,我有一个按钮,单击它时,执行以下操作
[self.navigationController pushViewController:_s animated:YES];

_s 表示 SecondViewController,其委托(delegate)是 F​​irstViewController

在 doneSucceed 方法中执行以下操作
- (void)doneSucceed:(NSString *)msg
{
    NSLog(@"%@", msg);
    [self.navigationController popViewControllerAnimated:YES];
    [self.navigationController pushViewController:_t animated:YES];
}

然后错误

nested push animation can result in corrupted navigation bar show, anyone tell me why? THX

最佳答案

问题是您正在调用 pop 和 push 动画背靠背。在 iOS6 中,推送调用基本上被忽略,但在 iOS7 中,推送是在弹出动画时调用的,因此它们是“嵌套的”,您会得到以下信息:

nested push animation can result in corrupted navigation bar show

您可以从 SecondViewController 进行 pop 调用,而不是在 doneSucceed 中弹出。然后等待FirstViewController的viewDidAppear推送ThirdViewController。您可以使用 doneSucceed 方法来切换是否应该转换到 viewDidAppear 上的 ThirdViewController

关于ios - 嵌套推送动画会导致导航栏损坏 PUSH POP PUSH,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19886660/

相关文章:

ios - 在 iPhone 项目中禁用 iBeacons

iphone - 如何在 iPhone sdk,objective-c 中获取 UIWebView 的内容高度?

带有覆盖的 iOS 7 UIImagePickerController - 重拍和使用照片不可用

ios - 'AcceptView' 没有可见的@interface 声明选择器 'presentViewController:animated:completion:'

ios - "Memory is managed automatically"- 怎么样?

ios - 字符串扩展给出额外参数错误

iphone - 在 Xcode 4 的 Interface Builder 中滚动 UIScrollView

html - 从 iOS Swift 中的摄像头扫描仪 SDK 返回时,WKwebview 是空白屏幕吗?

iphone - armv7 iPhone 警告

iphone - 如何旋转MKMapView并保持Annotation和 View 不旋转?