YungCheng Su
YungCheng Su

Reputation: 193

Change Selected Image Bug In Swift

I have a Button and want to change the selected image. But after change the image of the button. There show a blue point on the button.

After Selected

Before Selected

@IBAction func VideoShowBtn(sender: AnyObject) {

    if VideoShowOutlet.selected {
        playerVideo.hidden = false
        VideoShowOutlet.selected = !VideoShowOutlet.selected
    } else {
        playerVideo.hidden = true
        VideoShowOutlet.selected = !VideoShowOutlet.selected
    }

    playerVideo.play()
}

But with the same code. Some button won't shows the blue point.

@IBAction func ShareContentShowBtn(sender: AnyObject) {

    if ShareContentShowOutlet.selected {
        ShareVideoURLTF.hidden = false
        ShareVideoContentTV.hidden = false
        ShareContentShowOutlet.selected = !ShareContentShowOutlet.selected
    } else {
        ShareVideoURLTF.hidden = true
        ShareVideoContentTV.hidden = true
        ShareContentShowOutlet.selected = !ShareContentShowOutlet.selected
    }

}

Can anyone tell me why and how to fix it? Thanks!

Upvotes: 0

Views: 104

Answers (1)

Arthur Alves
Arthur Alves

Reputation: 458

Fastest way to solve it: Set tintColor to clearColor, on StoryBoard: enter image description here

Or programmatically:

VideoShowOutlet.tintColor = UIColor.clearColor()

Upvotes: 1

Related Questions