ios - 将一个控制器的View添加到scrollView中,滑出屏幕为什么不走ViewDidDisapper方法?
PHP中文网
PHP中文网 2017-04-18 09:44:00
0
4
573

将多个控制器的View添加到scrollView中,就第一次进入的时候会走ViewDidAppear方法,滑动屏幕为什么不走ViewDidDisapper或者ViewDidAppear方法?

PHP中文网
PHP中文网

认证高级PHP讲师

reply all (4)
Ty80

If you directly add the view in the viewController to the view controlled by another controller using the addSubView method, in this case, because the view has left the control scope of the original controller, the callbacks related to the display and hiding of the view will not be available. It worked. It needs to be handled manually under the current controller, such as manually calling the viewDidDisappear method of the controller corresponding to that view when sliding the scrollView to a certain range, etc.

It is recommended to use childViewController.

    左手右手慢动作

    Are you sure you don’t want to leave?

      洪涛

      Is this method done after the sliding is finished?

        PHPzhong

        Sliding the screen does not remove the controller and the views it controls. Of course it does not ViewDidDisapper

          Latest Downloads
          More>
          Web Effects
          Website Source Code
          Website Materials
          Front End Template
          About us Disclaimer Sitemap
          php.cn:Public welfare online PHP training,Help PHP learners grow quickly!