没有'|'候选人产生预期的上下文结果类型'NSTextStorageEditActions' [英] No '|' candidates produce the expected contextual result type 'NSTextStorageEditActions'

查看:232
本文介绍了没有'|'候选人产生预期的上下文结果类型'NSTextStorageEditActions'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在文本工具包教程 http://raywenderlich.com =noreferrer> raywenderlich.com 和行

I went through the Text Kit Tutorial on raywenderlich.com and the line

edited(.EditedCharacters | .EditedAttributes, range: range, changeInLength: (str as NSString).length - range.length)

产生以下错误:

No '|' candidates produce the expected contextual result type 'NSTextStorageEditActions'

当我将第一个参数更改为:

The error goes away when I change the first argument to:

edited(.EditedCharacters, range: range, changeInLength: (str as NSString).length - range.length)

我也试过用OR和||没有任何成功。

I also tried using "OR" and "||" without any success.

Swift 2.2和iOS 9.2

Swift 2.2 and iOS 9.2

推荐答案

@ dfri是对的。为了说明使用管道的另一个例子,|是在为UIImageView执行autoResizingMask时,如下所示:

@dfri is correct. To illustrate another example of using the pipe, "|", is when doing the autoResizingMask for UIImageView as follows:

imageView.autoresizingMask = [。 FlexibleWidth,.FlexibleHeight,...]

当然你要替换 ...... 使用其他 UIViewAutoresizing 选项。

Of course you'd replace the ... with other UIViewAutoresizing options.

祝你好运!

这篇关于没有'|'候选人产生预期的上下文结果类型'NSTextStorageEditActions'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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