Ios UITableViewController和UIViewController之间的容器视图转换,为什么边界混乱?

Ios UITableViewController和UIViewController之间的容器视图转换,为什么边界混乱?,ios,xcode-storyboard,Ios,Xcode Storyboard,我试图在嵌入容器视图的两个视图控制器之间实现翻转。在真正的应用程序中,翻转按钮在地图和列表之间切换 在这个问题的模型中,Coffee UITableViewController被替换为Sweets UIViewController 在简单的情况下,它工作得很好,但是当我向Sweets控制器添加一个segue以转到一个child UIViewController时,在执行以下操作-翻转-翻转-翻转-返回-翻转后,事情会出错。重复这些操作,tableview就会慢慢从屏幕上消失 FlipView

我试图在嵌入容器视图的两个视图控制器之间实现翻转。在真正的应用程序中,翻转按钮在地图和列表之间切换

在这个问题的模型中,Coffee UITableViewController被替换为Sweets UIViewController

在简单的情况下,它工作得很好,但是当我向Sweets控制器添加一个segue以转到一个child UIViewController时,在执行以下操作-翻转-翻转-翻转-返回-翻转后,事情会出错。重复这些操作,tableview就会慢慢从屏幕上消失

FlipViewController中的代码是:

@interface FlipViewController ()
@property (strong, nonatomic) UIViewController *controller1;
@property (strong, nonatomic) UIViewController *controller2;
@property (strong, nonatomic) UIViewController *currentViewController;
@end

@implementation FlipViewController

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.controller1 = [self.childViewControllers firstObject];
    self.currentViewController = self.controller1;

    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Storyboard" bundle:nil];
    self.controller2 = [storyboard instantiateViewControllerWithIdentifier:@"Sweets Controller"];
    [self addChildViewController:self.controller2];
}


- (IBAction)flip:(id)sender {
    if (self.currentViewController == self.controller1) {
        [self transitionFromViewController:self.controller1 toViewController:self.controller2 duration:0.3 options:UIViewAnimationOptionTransitionFlipFromRight animations:nil completion:^(BOOL finished) {
            [self.controller2 didMoveToParentViewController:self];
            self.currentViewController = self.controller2;
        }];
    }
    else {
        [self transitionFromViewController:self.controller2 toViewController:self.controller1 duration:0.3 options:UIViewAnimationOptionTransitionFlipFromRight animations:nil completion:^(BOOL finished) {
            [self.controller2 didMoveToParentViewController:self];
            self.currentViewController = self.controller1;
        }];
    }
}
@end

一些调试似乎表明UITableView的边界在返回时变得混乱。我是否有自动布局问题,或者我从ViewController转换的方法是否是获得这种效果的错误方法?如果您有任何建议,我将不胜感激,我已经被这个错误困扰太久了

它是常规
UIViewController
上的
UITableView
还是
UITableViewController
?在这个模型中,它是UITableViewController,但我试过使用包含UITableView的UIViewController,但仍然遇到问题。位置每次都会改变20次吗?哦,是的。我不确定确切的原因或解决办法,但是。。。64=20(状态栏)+44(导航栏)。