菜鸟教程小白 发表于 2022-12-13 02:53:53

ios - 如何从另一个 UIViewController 向下滑动


                                            <p><p>我不知道标题是否明确,所以我将在这里进行更多解释。
我现在有一个 <strong><code>UIViewController</code></strong> 和一个链接到 <strong><code>IBAction< 的 <strong><code>UIButton</code></strong>/code></strong> 触发另一个 <code>UIViewController</code>。我想通过让用户向上滑动来避免点击这一步,就像拖动其他 <code>UIViewController</code> 一样。我发现的一切都只是 <strong><code>UIGestureRecognizer</code></strong>,但我找不到任何控件或任何教程来拖动 <strong><code>UIViewController</code></strong>。
基本上,如果我制定这种 child 方式,我想用一个手指手势从底部滑动 <strong><code>UIViewcontroller</code></strong>,并且 <strong><code> UIViewController</code></strong> 确实跟随我的手指。
感谢您的帮助!</p>

<p>编辑:我不使用 Storyboard ,顺便说一句</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>导入 QuartzCore 框架并为你想要的做这个,就像一个窗口从底部出现,就像在 ios7 控制中心中一样</p>

<pre><code>- (void)viewDidLoad
    {
      upwardView=[init];
      upwardView.backgroundColor=;


      UISwipeGestureRecognizer *gesture = [ initWithTarget:self action:@selector(didSwipe:)];
      gesture.direction = UISwipeGestureRecognizerDirectionUp;
      ;
      ;
      // Do any additional setup after loading the view, typically from a nib.
    }
    -(void)didSwipe:(UIGestureRecognizer *)gestureRecognizer
    {
      ;
      CATransition *animation = ;
      ;
      ;
      ;
      ;
      ];
      CALayer *layer = ;
      ;
      ;
    }
</code></pre></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 如何从另一个 UIViewController 向下滑动,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/17162849/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/17162849/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 如何从另一个 UIViewController 向下滑动