Metin Atalay Metin Atalay - 25 days ago 8
Swift Question

Swift Some method Button text not change

I have one button in uiview

and i change button name and i get button name , it Getting old reputation . however When I call it from somewhere when the method is finished its true

Thanks,

enter image description here

Answer

Wrapping your if statements in a performWithoutAnimation block will prevent any delays in updates to the titleLabel.

UIView.performWithoutAnimation {
    if btnOne.titleLabel?.text == "qq" {
        btnOne.setTitle("metin", forState: .Normal)
        var a = btnOne.titleLabel?.text // "metin"
        mergeString += sender.titleLabel!.text!
    }
    ...
}