gpt4 book ai didi

ios - UIScrollView如何设置ContentInset和ScrollerInset

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:49:11 24 4
gpt4 key购买 nike

我无法配置我的 UIScrollView。

enter image description here

上图展示了我的观点。橙色框是我的 UIScrollView,蓝色框(加上橙色框)是我要滚动的 View 。

View 是 520px,UIScollView(像往常一样)是 320px。

如何设置 ContentInset 和 ScollerInset?

最佳答案

由于 ScrollView 的高度与其内容相匹配,而且从您的图片中看不出您想向内容中添加空白区域,因此您应该保留 contentInset 设置为零(默认情况下)。如果您希望通过 ScrollView 可以看到内容的中间位置,请将内容偏移量设置为 (520-320)/2 = 100,如下所示:

[scrollView setContentOffset:CGPointMake(100, 0) animated:YES];
// If you do not want to see the view scroll, change this ^^^ to NO

关于ios - UIScrollView如何设置ContentInset和ScrollerInset,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11934452/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com