首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >'ContentMode‘不是'UIView’的成员类型

'ContentMode‘不是'UIView’的成员类型
EN

Stack Overflow用户
提问于 2018-09-20 01:23:16
回答 1查看 2.7K关注 0票数 1

下面的代码可以很好地应用于旧式IOS应用程序,但现在不再适用于xcode 9:

我得到的错误是:

代码语言:javascript
复制
'ContentMode' is not a member type of 'UIView'

以下是代码:

代码语言:javascript
复制
import Foundation

struct ImageViewLayout {
    static func frameForImageWithSize(_ image: CGSize, previousFrame: CGRect, inContainerWithSize container: CGSize, usingContentMode contentMode: UIView.ContentMode) -> CGRect {
        let size = sizeForImage(image, previousSize: previousFrame.size, container: container, contentMode: contentMode)
        let position = positionForImage(size, previousPosition: previousFrame.origin, container: container, contentMode: contentMode)

        return CGRect(origin: position, size: size)
    }
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-09-20 01:29:21

枚举类型名称UIView.ContentMode在SWIFT4.2中是新的,在Xcode 10中引入,在此之前(如您所说的Xcode 9 )是UIViewContentMode

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52416192

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档