- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 self.navigationController
作为 View Controller 容器从我当前的 View Controller self
过渡到 self.aVC
容器。当我运行下面的代码时,弹出“ subview Controller 必须有一个共同的父 View Controller ”错误,但是两个 NSLogs 显示相同的 parentViewController。
这里似乎有什么问题?感谢您的帮助。
[self willMoveToParentViewController:nil];
[self.navigationController addChildViewController:self.aVC];
[self.aVC.view setFrame:self.bottomFrame];
NSLog(@"%@",self.parentViewController);
NSLog(@"%@",self.aVC.parentViewController);
// __weak __block SBSomeVC *weakSelf = self;
[self transitionFromViewController:self toViewController:self.aVC duration:0.3 options:UIViewAnimationOptionTransitionNone animations:^{
[self.aVC.view setFrame:self.view.bounds];
} completion:^(BOOL finished) {
[self.aVC didMoveToParentViewController:self.navigationController];
[self removeFromParentViewController];
}];
最佳答案
错误:
Children view controllers must have a common parent view controller
告诉你一切。参与转换的两个 View Controller 必须具有相同的父级。因此,您需要使用 addChildViewController:
方法将它们都添加到父级。否则将无法正常工作。
transitionFromViewController:toViewController:duration
方法必须由父 View Controller 调用。不是由 child 。
关于objective-c - 过渡从 View Controller :toViewController error: children view controllers must have a common parent view controller,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22209741/
这是我的问题的一个例子: 我在 ViewControllers A 和 B 中有 StarImageView,它们显示相同的图像,但在其 ViewController 中具有彼此不同的帧。 当点击 V
我正在使用 iOS 7 引入的新自定义过渡,我正在尝试将 View 从我的“主” View Controller 移动到我的“详细” View Controller 中的 View ,有点像 Phot
我似乎找不到关于如何正确使用 transitionFromViewController:toViewController:duration:options:animations:completion:
我正在尝试使用 UIViewController 的 transitionFromViewController:toViewController:duration 方法,但带有自定义动画。 我将以下两
错误不是每次都有。我曾尝试清理和重建应用程序,但它也是。 错误: *** Assertion failure in -[UIWindowController transition:fromV
我正在尝试使用 self.navigationController 作为 View Controller 容器从我当前的 View Controller self 过渡到 self.aVC容器。当我运
我是一名优秀的程序员,十分优秀!