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:
我认为最好创建一个UIView并使用gesturerecognizer进行操作(按键等)。
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.