二元运算符'|'不能应用于两个UIViewAutoresizing操作数 [英] Binary operator '|' cannot be applied to two UIViewAutoresizing operands

查看:152
本文介绍了二元运算符'|'不能应用于两个UIViewAutoresizing操作数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Swift 2.0中获取此错误。

Getting this error in Swift 2.0.


二进制运算符'|'不能应用于两个UIViewAutoresizing操作数

Binary operator '|' cannot be applied to two UIViewAutoresizing operands

以下是代码:

let view = UIView(frame: CGRect(x: 0, y: 0, width: 320, height: 568))
addSubview(view)
view.autoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight

任何想法可能是什么问题?

Any idea what can be the problem?

推荐答案

OptionSetType 获得了Swift 2.x的更新语法和Swift 3.x的另一个更新

The OptionSetType got an updated syntax for Swift 2.x and another update for Swift 3.x

Swift 3.x

view.autoresizingMask = [.flexibleWidth, .flexibleHeight]

Swift 2.x

view.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]

这篇关于二元运算符'|'不能应用于两个UIViewAutoresizing操作数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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