Reputation: 81
How can I create this button programmatically:
I am already tried this:
buttonLike.setImage(UIImage(named: "imageLikeForButton"), forState: UIControlState.Normal)
buttonLike.setTitle("Like ", forState: UIControlState.Normal)
buttonLike.tintColor = UIColor(red: 170.0/255.0, green: 170.0/255.0, blue: 170.0/255.0, alpha: 1.0)
buttonLike.transform = CGAffineTransformMakeScale(-1.0, 1.0)
buttonLike.titleLabel!.transform = CGAffineTransformMakeScale(-1.0, 1.0)
buttonLike.imageView!.transform = CGAffineTransformMakeScale(-1.0, 1.0)
But it work only for one text and one image:
Upvotes: 3
Views: 92
Reputation: 1
You can create an UIView and put everything in this view. Then put a transparent button on the top of this view. I think this is an easier way.
Upvotes: 0
Reputation: 50
I think is better create a UIView and use gesturerecognizer for your actions (key pressed, etc).
Upvotes: 1