Extended UIButton border is not initially drawn

This works public class MyButton : UIButton { public MyButton() : base(UIButtonType.RoundedRect) { } public override RectangleF Frame { get { return base.Frame; } set { var temp = TranslatesAutoresizingMaskIntoConstraints; TranslatesAutoresizingMaskIntoConstraints = false; var constraints = new [] { NSLayoutConstraint.Create(this, NSLayoutAttribute.Width, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1.0f, value.Width), NSLayoutConstraint.Create(this, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1.0f, value.Height) }; AddConstraints(constraints); … Read more

How do you set an Attributed Title Color for State in Swift

// create the button let button = UIButton(frame: CGRect(x: 0, y: 0, width: 100, height: 50)) button.backgroundColor = UIColor.yellowColor() // set the attributed title for different states // .Selected let mySelectedAttributedTitle = NSAttributedString(string: “Click Here”, attributes: [NSForegroundColorAttributeName : UIColor.greenColor()]) button.setAttributedTitle(mySelectedAttributedTitle, forState: .Selected) // .Normal let myNormalAttributedTitle = NSAttributedString(string: “Click Here”, attributes: [NSForegroundColorAttributeName : UIColor.blueColor()]) button.setAttributedTitle(myNormalAttributedTitle, … Read more

tech