如何检测UITableView标头(表头,而不是节头)何时滚动到可见区域?
提前致谢!
我正在尝试UITextInputTraits使用默认方法扩展类绑定协议 ( ):
extension UITextInputTraits where Self: UIView {
func setTextInputTraits() {
self.autocapitalizationType = .none // <- compiler error
}
}
Run Code Online (Sandbox Code Playgroud)
它给出了一个"Cannot assign to property: 'self' is immutable"错误。
如果我将约束从UIView改为UITextField,它会起作用,但这违背了使用协议的目的。
为什么是错误?我怎样才能实现这个默认方法?
谢谢!
mutating,因为'mutating' isn't valid on methods in classes or class-bound protocols尝试向 self 发送消息,Objective-C 风格,但perform不适用于非对象值参数:
func setTextInputTraits() {
let sel = #selector(setter: self.autocapitalizationType)
self.perform(sel, with: .none)
}
Run Code Online (Sandbox Code Playgroud)在Xcode 11 beta 3中可以正常编译的项目,在pod 4中存在错误的情况下不能在beta 4中编译:
<unknown>:0: error: unknown argument: '-Wno-shorten-64-to-32'
Command CompileSwiftSources failed with a nonzero exit code
Run Code Online (Sandbox Code Playgroud)
有问题的吊舱是Down,它是Swift中的Markdown库。
这与另一个SO问题非常相似,但有一个不同的“未知参数”:
错误:未知参数:'-Wno-shorten-64-to-32'
有什么建议么?