如何在 swift 3.0 中设置滚动视图内容大小

how to set scrollview content size in swift 3.0(如何在 swift 3.0 中设置滚动视图内容大小)
本文介绍了如何在 swift 3.0 中设置滚动视图内容大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

更新后的 Xcode8 无法为 ScrollView 设置 contentSize.我无法使用 CGSizeMake.谁能帮帮我?

After updated Xcode8 not able to set contentSize for ScrollView. I can't able to use CGSizeMake. Can anyone help me?

我试过了

scrollView.contentSize = CGSizeMake(self.view.frame.size.width, 700)

推荐答案

从 Swift 3 CGSizeMake 不可用,使用 CGSize init 代替.

From Swift 3 CGSizeMake is not available use CGSize init instead.

scrollView.contentSize = CGSize(width: self.view.frame.size.width, height: 700)

从 Swift 3 开始,查看关于 Core Graphics 的 Apple 文档,他们已经做了很多变化.

Check the Apple Documentation on Core Graphics as of from Swift 3 they have made a lot of changes.

这篇关于如何在 swift 3.0 中设置滚动视图内容大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

UIScrollView and Cocos2D(UIScrollView 和 Cocos2D)
Can`t copy file from bundle to documents directory in iOS(无法将文件从捆绑包复制到 iOS 中的文档目录)
How to copy a quot;Dictionaryquot; in Swift?(如何复制“字典在斯威夫特?)
Swift - How to mutate a struct object when iterating over it(Swift - 迭代结构对象时如何对其进行变异)
How to copy text to clipboard/pasteboard with Swift(如何使用 Swift 将文本复制到剪贴板/粘贴板)
Swift Cannot invoke #39;find#39; with an argument list of type #39;([Score], Score)#39; where Score is a struct(Swift 无法使用类型为“([Score],Score)的参数列表调用“find,其中 Score 是一个结构)