FlexColorPicker: Crash iOS15
I use a very simple color picker, just the default:
let colorPickerController = DefaultColorPickerViewController()
colorPickerController.delegate = self
colorPickerController.selectedColor = UIColor.init(hex: user.invoice_color_hex)
colorPickerController.navigationItem.title = "Settings_InvoiceLayout_HeadersColor".localized()
self.navigationController?.pushViewController(colorPickerController, animated: true)
It has always worked perfectly, until iOS15. It seems to crash on this line:
public var contentBounds: CGRect {
layoutIfNeeded()
return contentView.frame
}
//Previous functions before it arrived here
private func updateCornerRadius() {
gradientBackgroundView.cornerRadius_ = contentBounds.height / 2
}
open override var bounds: CGRect {
didSet {
updateCornerRadius()
updateThumbAndGradient(isInteractive: false)
}
}
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 19 (7 by maintainers)
Commits related to this issue
- Proper fix for iOS 15 issues #35 and #36 — committed to RastislavMirek/FlexColorPicker by RastislavMirek 3 years ago
I didn’t have time to fully dive into it and I needed an update fast, so I fixed it using the ugliest code possible. I knew it was calling some methods over and over, probably a layoutIfNeeded() that automatically called something that then again called layoutIfNeeded(). So I just needed some booleans to only call these one time. I finally found 3 places where I needed to intervene. Here are the classes and the methods that got it working again for me. FYI, obviously this is not a correct fix and I will not submit a pull request for this. But this might help someone who is trying to fix it in a good way 😃
First class: AdjustedHitBoxColorControl
Second class: ColorPaletteControl
Third class: ColorSliderControl
This should be fixed in 1.4.4