Last active
September 17, 2018 15:48
-
-
Save grifas/c1c8537949cae482db1c2918d1232882 to your computer and use it in GitHub Desktop.
UITableViewCell with a self sizing accessory view
This file contains 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
class MyCell: UITableViewCell { | |
init() { | |
// Initialize... | |
accessoryView = UIView() | |
accessoryView?.translatesAutoresizingMaskIntoConstraints = false | |
addSubview(accessoryView!) | |
// With SnapKit | |
accessoryView?.snp.makeConstraints({ make in | |
make.centerY.equalToSuperview() | |
make.right.equalToSuperview().inset(16) | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment