动态检测UIScrollView的高度 [英] Detect a UIScrollView's height dynamically
问题描述
我有一个检测的UIScrollView高度的一个现实问题。我搜索了很多,发现这个解决方案:
I have a real problem with detecting UIScrollView height. I searched a lot and found this solution:
所以,我从查看内容
拖到查看
和取得等高
。但是,我并不为我工作。
So I dragged from Content View
to View
and made Equal Height
. But I does not work for me.
我也试过根据其元素的高度来计算滚动视图的高度,但我不认为这是正确的方式。
I also tried to calculate scrollView height according to elements height in it, but I do not think that it's a right way.
我如何设置UIScrollView的高度动态?什么是做了正确的方法是什么?
How can I set UIScrollView height dynamically? What is the correct way for doing it?
推荐答案
您滚动型
应该添加的内容查看是这样的:
Your ScrollView
should add a ContentView like this:
选择您的滚动视图
,大小督察底部,设置宽度是这样的:
select your scrollView
and in size Inspector bottom, set the width like this:
有关如何处理滚动视图
在界面生成器您可以检查出这个AppleDoc <一个更多详情href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/WorkingwithScrollViews.html#//apple_ref/doc/uid/TP40010853-CH24-SW1\"相对=nofollow称号=自动布局指南>与滚动视图工作
for more details on how to handle scrollView
in Interface Builder your can check out this AppleDoc Working with Scroll Views
希望这有助于你!
这篇关于动态检测UIScrollView的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!