Ich muss zwei Bilder (mit Animation) auf UIButton umschalten, aber das versteckt meine Beschriftung hinter Bild auf UIButton. Daher habe ich Subview von UILabel hinzugefügt und das wird auch nicht angezeigt. Ich habe sogar versucht, die Subview nach vorne zu bringen, aber das funktioniert auch nicht.UIButton text nicht sichtbar beim animieren button image
let options = [option_1, option_2, option_6]
var imageArray = [UIImage]()
imageArray.append(UIImage(named: "light_button.png")!)
imageArray.append(UIImage(named: "dark_button.png")!)
let label = UILabel(frame: CGRect(x: 0, y: 0, width: self.option_1.frame.width, height: self.option_1.frame.width))
label.text = "HEY"
label.font = UIFont.systemFont(ofSize: 18)
option_1.addSubview(label)
option_1.bringSubview(toFront: label)
for option in options{
option?.setImage(UIImage(named: "green_button.png")!, for: .normal)
option?.imageView!.animationImages = imageArray
option?.imageView!.animationImages = imageArray
option?.setTitle("TEST TEXT", for: .normal) //Even this don't work
option?.imageView!.animationDuration = 2.35
option?.imageView!.startAnimating()
}
Was ist los?
Was haben Sie im Optionsfeld hinzugefügt? – Ishika
@ishika das sind die UIButtons. – Prateekro
Ich wollte fragen, haben Sie Steckdosen erstellt oder Tasten programmgesteuert erstellt? – Ishika