我正在尝试编写我自己的、自定义的UIStoryboardSegue,其中UIView从sourceViewController“幻灯片”到destinationViewController。目前,我的代码如下:
- (void)perform {
UIViewController *sourceViewController = self.sourceViewController;
UINavigationController *navigationController = [[self sourceViewController] navigationController];
RestaurantViewController *destinationViewController = self.destinationViewController;
destinationViewController.colors.frame = CGRectMake(0, 0, 10, 10);
[sourceViewController.view addSubview:destinationViewController.tables];
[UIView animateWithDuration:10.0
delay:0.0
options:UIViewAnimationOptionCurveEaseInOut
animations:^{
destinationViewController.tables.frame = CGRectMake(100, 100, 100, 100);
}
completion:^(BOOL finished){
[destinationViewController.tables removeFromSuperview]; // remove from temp super view
[navigationController pushViewController:destinationViewController animated:NO]; // present VC
}];
}作为一个测试,我只是在玩表视图的框架。我还将持续时间设置为10秒,这样我就可以看到所有的东西。然而,destinationViewController只是突然出现,完全忽略了我编写的所有代码。我在这里做错什么了?
发布于 2016-05-28 23:42:19
你好,我正在尝试用您的代码来实现这个功能,但是我发现您的主要问题是您的destinationViewController.tables是零,这就是为什么似乎什么都不起作用。
您需要确保您的destinationViewController.tables不是零,您可以在您的RestaurantViewController类中这样做
- (instancetype)initWithCoder:(NSCoder *)coder
{
self = [super initWithCoder:coder];
if (self) {
self.tables = [[UIView alloc]initWithCoder:coder];
}
return self;
}希望这能帮到你。对不起我的英语
https://stackoverflow.com/questions/37503975
复制相似问题