首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >自定义UIStoryboardSegue无法工作

自定义UIStoryboardSegue无法工作
EN

Stack Overflow用户
提问于 2016-05-28 21:41:27
回答 1查看 51关注 0票数 0

我正在尝试编写我自己的、自定义的UIStoryboardSegue,其中UIViewsourceViewController“幻灯片”到destinationViewController。目前,我的代码如下:

代码语言:javascript
复制
- (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只是突然出现,完全忽略了我编写的所有代码。我在这里做错什么了?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-05-28 23:42:19

你好,我正在尝试用您的代码来实现这个功能,但是我发现您的主要问题是您的destinationViewController.tables是零,这就是为什么似乎什么都不起作用。

您需要确保您的destinationViewController.tables不是零,您可以在您的RestaurantViewController类中这样做

代码语言:javascript
复制
    - (instancetype)initWithCoder:(NSCoder *)coder
      {
        self = [super initWithCoder:coder];
        if (self) {
            self.tables = [[UIView alloc]initWithCoder:coder];
         }
       return self;
      }

希望这能帮到你。对不起我的英语

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37503975

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档