button.setImage(#imageLiteral(resourceName: "flight_deselect")**.changeToLightGrayLightTint(), for: .normal)
在iPhone上运行良好,但在iPad上崩溃。
请参考以下代码:
func changeButtonState(_ type: ModuleDetails, _ isSelected: Bool, _ button: UIButton) {
switch type {
case .Flight:
if isSelected {
button.setImage(#imageLiteral(resourceName: "flight_select").changeToPrimaryLightTint(), for: .normal)
} else {
button.setImage(#imageLiteral(resourceName: "flight_deselect").changeToLightGrayLightTint(), for: .normal)
}
case .Hotel:
if isSelected {
button.setImage(#imageLiteral(resourceName: "hotel_select").changeToPrimaryLightTint(), for: .normal)
} else {
button.setImage(#imageLiteral(resourceName: "hotel_deselect").changeToLightGrayLightTint(), for: .normal)
}
}
}
崩溃日志
无法加载从笔尖引用的“ flight_select”图像 带有标识符的捆绑包