I'm pretty new to Swift, currently writing an AR game. Seems like my issue is very basic, but I can't figure it out.
I added a button to an AR Scene through the storyboard and linked it to an IBAction function (which works correctly when the button is clicked). I gave the button an image and deleted the Title. See how the button shows up in the storyboard: button in Xcode storyboard without Title
But when I run the app, the button image shows up with a default label (saying "Button") as shown in this image: button in iPhone screenshot WITH label next to the button image
I can't figure out why this label is there and how to remove it. Should I add the button programmatically instead of adding it through the storyboard? Should the button be treated differently because it's an AR app?
I was able to remove the label by adding the same UIButton as an IBOutlet and adding the following line in viewWillAppear:
restartButton.titleLabel?.text = ""
But this feels to me like a workaround and not a real solution. Also, as soon as I click on the button, the label shows up again. I tried to add the same workaround line to the function when the button is clicked, but that didn't help.
I'm sure I'm missing something very simple. Your help would be appreciated.
Thanks!
In iOS-15, Xcode-13.1 we are facing the same issue, You can change the same with Interface Builder via changing the "style" state from "Plane" to "Default" and then removing the title for that button, It will work perfectly fine as shown below:-
The initial state of the button is assigned as Plane like below:-
Then change the button style property as Default and remove title text for the same like below:-
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With