We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
版主你好,游標卡尺滑動時候數字沒有跟著更換。 我將 indexValueCallback 改寫到 setItem裡面處理。 其原因是因為self.item在還沒初始化之前他取不到值。所以原先block在guard語句之後就會返回。 後續的函數功能都不會執行。
我的理解是 -> indexValueCallback 不能寫在懶加載定義裡面。因為初始化的時候 自己的CellProtocol 協議還沒有值 self.item 會造成崩潰
所以進行了下面的修改 func setItem(_ item: CLRecordVernierCaliperItem, indexPath: IndexPath) { self.vernierCaliperView.indexValueCallback = {[weak self] (value) in
guard let weakSelf = self else { return } //item -> CLRecordVernierCaliperItem weakSelf.item?.value = value.cgFloat weakSelf.item?.valueChangeCallback?(value) weakSelf.valueLabel.attributedText = weakSelf.attributedString(value, type: item.type) }
//其餘代碼 }
您參考看看
The text was updated successfully, but these errors were encountered:
No branches or pull requests
版主你好,游標卡尺滑動時候數字沒有跟著更換。
我將 indexValueCallback 改寫到 setItem裡面處理。
其原因是因為self.item在還沒初始化之前他取不到值。所以原先block在guard語句之後就會返回。
後續的函數功能都不會執行。
我的理解是 -> indexValueCallback 不能寫在懶加載定義裡面。因為初始化的時候 自己的CellProtocol 協議還沒有值 self.item 會造成崩潰
所以進行了下面的修改
func setItem(_ item: CLRecordVernierCaliperItem, indexPath: IndexPath) {
self.vernierCaliperView.indexValueCallback = {[weak self] (value) in
//其餘代碼
}
您參考看看
The text was updated successfully, but these errors were encountered: