![](/img/trans.png)
[英]How can I create a segue programmatically to pass info between view controllers - Swift
[英]Swift - How can I create button with two texts and image between them programmatically?
如何以編程方式創建此按鈕:
我已經嘗試過了:
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)
但它只適用於一個文本和一個圖像:
我認為最好創建一個UIView並使用gesturerecognizer進行操作(按鍵等)。
您可以創建一個UIView並將所有內容放在此視圖中。 然后在此視圖的頂部放置一個透明按鈕。 我認為這是一種更簡單的方法。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.