我以编程方式创建一个UINavigationController –
UIStoryboard *storyBoard = [UIStoryboard storyboarDWithname:@"InBoxStoryboard" bundle:nil];UIVIEwController *innerVIEwController = [storyBoard instantiateVIEwControllerWithIDentifIEr:@"centerVIEw"];UINavigationController *centerVIEw = [[UINavigationController alloc] initWithRootVIEwController:innerVIEwController];
然后我替换包含在动画块中的窗口根视图控制器 –
[UIVIEw TransitionWithVIEw:self.vIEwController.vIEw.window duration:0.5 options: UIVIEwAnimationoptionTransitionFlipFromleft animations:^{ self.vIEwController.vIEw.window.rootVIEwController = centerVIEw; } completion:nil];
发生的事情是动画发生但我创建的控制器只是部分可见,请看下面的图片 –
因此,您可以在旋转期间看到视图仅部分呈现.
以前有人碰到过这种行为吗?
解决方法 经过长时间的搜索,我发现问题出在[UIVIEw TransitionWithVIEw:…]在stackoverflow中搜索了一下,我找到了 Swapping rootViewController with animation
使用[UIVIEw TransitionFromVIEw:..]可以很好地工作.
新代码 –
[UIVIEw TransitionFromVIEw:self.window.rootVIEwController.vIEw toVIEw:self.centerVIEwController.vIEw duration:0.5 options:UIVIEwAnimationoptionTransitionCurlUp completion:^(BOol finished) { self.window.rootVIEwController = self.centerVIEwController; }];总结
以上是内存溢出为你收集整理的iphone – 用动画替换window.rootViewController部分工作全部内容,希望文章能够帮你解决iphone – 用动画替换window.rootViewController部分工作所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)