UIScrollView内的UIButton,UIScrollview内的UIButton [英] UIButton inside UIScrollView, inside UIScrollview

查看:60
本文介绍了UIScrollView内的UIButton,UIScrollview内的UIButton的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

控制器A的视图包含一个UIScrollview,该UIScrollview包含一个UIButton.内容垂直滚动,按钮正常工作.

Controller A's view contains a UIScrollview which contains a UIButton. The content scrolls vertically and the button works fine.

控制器B的视图包含用于向左和向右分页的UIScrollview.

Controller B's view contains a UIScrollview for paging left and right.

当我将Controller A视图放置在Controller B的滚动视图内时,UIButton停止工作.

When I place my Controller A view inside the scroll view of Controller B's the UIButton stops working.

我无法嵌套"滚动视图,因为它们由独立的控制器管理-仅在某些情况下才需要分页.

I can't 'de-nest' the scrollviews because they are managed by independent controllers - and paging is only required under certain circumstances.

为什么控制器B会停止按钮的工作?

Why does Controller B stop the button from working?

推荐答案

来自UIViewController文档:

From the UIViewController docs:

注意:您不应该使用视图控制器来管理填充的视图只是他们窗户的一部分-也就是说,仅由应用程序内容矩形.如果你希望有一个由以下组成的接口几个较小的视图,将它们全部嵌入在单个根视图中进行管理使用您的视图控制器进行查看.

Note: You should not use view controllers to manage views that fill only a part of their window—that is, only part of the area defined by the application content rectangle. If you want to have an interface composed of several smaller views, embed them all in a single root view and manage that view with your view controller.

OS只为将事件发送到单个UIViewController而烦恼,无论它认为哪个处于活动状态并填充窗口.只有一个视图控制器才能确保获得包括旋转方法调用和内存警告在内的事件.

The OS only bothers to send events to a single UIViewController, whichever one it thinks is active and filling the window. Only that one view controller is sure to get events including rotation method calls and memory warnings.

这篇关于UIScrollView内的UIButton,UIScrollview内的UIButton的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆