我在raywendrlich.com上学习了文本工具包教程
edited(.EditedCharacters | .EditedAttributes, range: range, changeInLength: (str as NSString).length - range.length)
产生以下错误:
No '|' candidates produce the expected contextual result type 'NSTextStorageEditActions'
当我将第一个参数更改为:时,错误就消失了
edited(.EditedCharacters, range: range, changeInLength: (str as NSString).length - range.length)
我还尝试过使用"OR"one_answers"||",但没有成功。
Swift 2.2和iOS 9.2
@dfri是正确的。为了说明使用管道"|"的另一个例子,是在为UIImageView执行autoResizingMask时,如下所示:
imageView.autoresizingMask = [.FlexibleWidth, .FlexibleHeight, ...]
当然,您可以将...
替换为其他UIViewAutoresizing
选项。
祝你好运!
把它们都放在一个数组中,如下所示:
代替管道
let timeDateComponents = calendar.components(NSCalendarUnit.Hour| NSCalendarUnit.Minute| NSCalendarUnit.Second, fromDate: NSDate())
试试这个
let timeDateComponents = calendar.components([NSCalendarUnit.Hour, NSCalendarUnit.Minute, NSCalendarUnit.Second], fromDate: NSDate())