即使内容大小较大,Scrollview 也不会滚动 [英] Scrollview will not scroll even with larger contentsize

查看:30
本文介绍了即使内容大小较大,Scrollview 也不会滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

遇到一个我不明白的奇怪问题.

Got a strange problem which I dont understand.

我将内容大小设置为我创建的名为 newSize 的 CGSize.我在 UIScrollView 中的一行中添加按钮,该按钮超出滚动视图的框架并更改内容大小以匹配新的宽度 + 400 以确保安全.

I set the content size to a CGSize I created called newSize. I am adding buttons in a row in the UIScrollView that goes outside of the frame of the scrollview and changing the content size to match the new width + 400 for insurance.

    newSize.width = contentSizeWidth+400;

    NSLog(@"newSize width: %f", newSize.width);

    [_scrollViewOutlet addSubview:button];

    [_scrollViewOutlet setContentSize:newSize];

    NSLog(@"scrollviewOutlet Content Width: %f", _scrollViewOutlet.contentSize.width);

NSLog 打印出 768.在界面构建器的滚动视图中启用了滚动,但我无法滚动滚动视图?可能是什么问题?

the NSLog prints out 768. scrolling is enabled in the scrollview in interface builder but I cannot scroll the scrollview? What could the problem be?

推荐答案

我解决了这个问题.这是一个需要在视图中取消勾选的自动布局勾选框.

I resolved the issue. It was an autolayout tick box that needed unticking in the view.

这篇关于即使内容大小较大,Scrollview 也不会滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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