Reputation: 3777
I am trying to disable Highlighting on a UIButton setup in Storyboard. I am using Swift on Xcode 7.1. I have the button set to Custom, and I have tried everything I can think of, and it is still highlighting. Here is another question for Objective-C, and I have tried everything on it, even the Storyboard image name white space idea.
The button is hooked up correctly.
How do you disable highlighting? Is it a bug in Xcode?
Upvotes: 2
Views: 980
Reputation: 385970
I guess you mean you don't want the button to appear to change when it's tapped. One way to do it is by creating a subclass of UIButton
that refuses to become highlighted:
class NonHighlightingButton: UIButton {
override var highlighted: Bool {
set { }
get { return super.highlighted }
}
}
Then, in your storyboard, set the custom class of your button to NonHighlightingButton
:
Upvotes: 2