简体   繁体   English

为什么更改scrollView的contentsize值不会影响结果

[英]Why does changing contentsize value of scrollView doesnot effect the result

while using scrollview i have assigned contentSize (0,508) 在使用scrollview时,我分配了contentSize (0,508)

if i change it to (-77,508) or (150,508) shows same result. 如果我将其更改为(-77,508)(150,508)显示相同的结果。

which result in myView top side doesnot comes down (how ever if i change the value of myView to Y = 250 ) it runs good. 这导致myView顶部不会下降(但是如果我将myView的值更改为Y = 250 ),它将运行良好。 But it doesnot look good in storyboard as myView bottom side goes way down the builder. 但是,由于myView的底部朝生成器的方向倾斜,因此在情节提要中看起来不太好。

Any ideas, what i am doing wrong ? 任何想法,我在做什么错?

contentSize property is responsible for (literally) the size of your content. contentSize属性负责(从字面上看)内容的大小。 Setting it to (150, 508) says "I want my content to be 150pt wide and 508pt tall". 将其设置为(150, 508) 150,508 (150, 508)表示“我希望内容宽150pt,高508pt”。 It defines how far side-to-side or top-to-bottom your content can scroll. 它定义了内容可以左右滚动或上下滚动的距离。 It does not say anything about its actual position. 它没有透露其实际位置。 If you want to change the position of the view inside the scroll view, either change the subview's frame or take a look at contentOffset property of the scroll view 如果要更改滚动视图内部视图的位置,请更改子视图的框架或查看滚动视图的contentOffset属性

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM