动态检测UIScrollView的高度 [英] Detect a UIScrollView's height dynamically

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

问题描述

我有一个检测的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屋!

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