[英]Create UIButton offscreen with Interface Builder
I want to create a big UIScrollView
, its contentView should contain more than 30 UIButton
. 我想创建一个大的
UIScrollView
,它的contentView应该包含30个以上的UIButton
。 Positions of these UIButton
are not rectiligne and cannot be create 'programmaticaly' so I've placed all these UIButton
on a UIView
manually. 这些
UIButton
位置不是可调节的,不能以“编程方式”创建,因此我将所有这些UIButton
手动放置在UIView
。 I zoom/dezoom and scroll all over my UIScrollView
fine BUT here is my problem : 我缩放/缩放并在
UIScrollView
滚动, 但这里是我的问题:
UIButton
created offscreen is not accessible, I mean I can't click them (only UIButton
created in the CGRect(0.f, 0.f, 320.f, 480.f)
can be click. 无法在屏幕外创建的
UIButton
,我的意思是无法单击它们(只能单击在CGRect(0.f, 0.f, 320.f, 480.f)
创建的UIButton
。
Any suggestion ? 有什么建议吗?
Create a view, put a scrollView inside that view, and place your buttons on the scrollView. 创建一个视图,将一个scrollView放在该视图中,然后将按钮放在scrollView上。 While adding buttons and moving them around, be certain that they're always inside the scrollView by looking at the object hierarchy in interface builder.
在添加按钮并四处移动时,通过查看界面构建器中的对象层次结构,确保它们始终在scrollView内。
You can slide the scrollView around as you place things, no need to zoom. 您可以在放置事物时在周围滚动scrollView,而无需缩放。 As long as your buttons are children of your scrollView it should work fine.
只要您的按钮是scrollView的子级,它就可以正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.