Created
April 2, 2019 21:25
-
-
Save watura/d2f1abaf2848f52bb418707d0841cd95 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
import UIKit | |
public class BoxedDisclosureCell: UITableViewCell, CellType { | |
var boxView: UIView! | |
func bind() { | |
if boxView.isNil { | |
boxView = UIView(frame: CGRect(x: 0, y: 0, width: 10, height: 10)) | |
boxView.translatesAutoresizingMaskIntoConstraints = false | |
boxView.backgroundColor = UIColor.Zaim.colorBackgroundSub | |
boxView.layer.cornerRadius = 8 | |
backgroundView = boxView | |
NSLayoutConstraint.activate([ | |
boxView.topAnchor.constraint(equalTo: topAnchor, constant: 8), | |
boxView.leftAnchor.constraint(equalTo: leftAnchor, constant: 8), | |
rightAnchor.constraint(equalTo: boxView.rightAnchor, constant: 8), | |
bottomAnchor.constraint(equalTo: boxView.bottomAnchor, constant: 8), | |
boxView.heightAnchor.constraint(greaterThanOrEqualToConstant: 44) | |
]) | |
} | |
textLabel?.text = "2019年4月2日" | |
boxView.layoutIfNeeded() | |
layoutIfNeeded() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment