花了很多天都没搞定的问题,直接重置就解决了
问题来源:
- UIBarButtonItem : 自定义颜色,快速返回,颜色不恢复;
- 然后用[[UIBarButtonItem alloc] initWithCustomView:view]; 但是新问题,点击区域太小,不管图片大小有多大
- 最后的解决办法:直接进行重置UIBarButtonItem,这样颜色能恢复,同时不是出现可点击区域过小的问题
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
//直接重置
let image = R.image.hw_download()?.withRenderingMode(.alwaysOriginal)
let barBtnItem = UIBarButtonItem.init(image: image, style: .plain, target: self, action: #selector(downloadCourseFile))
self.navigationItem.rightBarButtonItem = barBtnItem
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
self.navigationItem.rightBarButtonItem = nil
}