Created
November 15, 2019 08:15
-
-
Save longlongjump/096ade4ed3472e4a61686b66d2429995 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UITableViewCell { | |
@objc func toggleDisclosureIndicator(show: Bool) { | |
guard #available(iOS 13, *) else { | |
self.accessoryType = show ? .disclosureIndicator : .none | |
return | |
} | |
guard show else { | |
accessoryView = nil | |
return | |
} | |
let conf = UIImage.SymbolConfiguration(pointSize: 14, weight: .semibold) | |
guard let image = UIImage(systemName: "chevron.right")?.withConfiguration(conf) else { | |
return | |
} | |
let imageView = UIImageView(image: image) | |
imageView.frame = CGRect(x: 0, y: 0, width: 12, height: 15) | |
imageView.contentMode = .scaleAspectFit | |
accessoryView = imageView | |
accessoryView?.tintColor = UIColor(red: 199/255.0, green: 199/255.0, blue: 204/255.0, alpha: 1) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment