-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iOS11以下崩溃 #22
Comments
我换电脑了 现在没有iOS11以下的环境, 能发一些详细的截图吗? 这个问题可以稳定复现吗? |
稳定复现,使用kvo的keypath的方式在iOS11以下好像要手动调用invalidate释放 class SXTextView: UITextView {
private let customLabel = UILabel()
@objc var string: String? {
didSet {
customLabel.text = "交易备注"
customLabel.font = .systemFont(ofSize: 12)
customLabel.backgroundColor = #colorLiteral(red: 0.9098039216, green: 0.2078431373, blue: 0.1333333333, alpha: 0.1004120291)
customLabel.textColor = #colorLiteral(red: 0.9098039216, green: 0.2078431373, blue: 0.1333333333, alpha: 1)
customLabel.textAlignment = .center
customLabel.frame = CGRect(x: 0, y: -3, width: 58, height: 23)
isEditable = false
isSelectable = false
attributed.text = .init("\(.view(customLabel, .original(.center))) \(string!)", .paragraph(.lineSpacing(7)))
attributed.layout()
}
}
@objc func layout() {
attributed.layout()
}
}
let textView = SXTextView()
textView.string = "qeqewqkqwkjrqwjrkjqjnsdnfajsnfieuwrhweirhiuweqweqwe"
view.addSubview(textView) 每次调用的页面释放时,崩溃信息如下:
|
你好, 还存在这个问题吗? 抱歉 过这么久才看到你的回复 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
在iOS11以下的系统,kvo的监听会崩溃,An instance 0x7f9395d49750 of class SXLabel was deallocated while key value observers were still registered with it. Current observation info:
使用了textView的attachment
attributed.text = .init("\(.view(customLabel, .original(.center))) \(string)", .paragraph(.lineSpacing(7)))
The text was updated successfully, but these errors were encountered: