Created
Oct ’16
Replies
11
Boosts
0
Views
1.1k
Participants
2
Not sure I understand your question.
What type of line do you want to draw ? For labels, isn't the border what you are looking for ? And for buttons, you can select with or without border.
Yes. I mean I want the labels and buttons to show borders.
So go to the Attributes inspector for each object and select either the type of border or check mark the "Visual bordered" item.
Please tell if that answer your question.
I see nothing in attributes inspector that says "border" when I have a label selected.
Select the label.
In the Attributes inspector, you should see a first part called TextField
On the fourth line, you have an attribute called Border, with four options for drawing : thick border, no border, thin border, rounded border.
Select the 3rd one.
I have selected a label and looked at Attributes Inspector. Nothing says TextField. I'm using Xcode version 7.3.1.
OK, it's my fault, I was thinking OSX when you deal with IOS !
Effectively, no border for labels in XCode for IOS.
I see 2 ways to go :
- Create a text field instead, select the border (they have one !) and deselect User interaction checkboxes
- SubClass label ("labelWithBorder") and implement in drawRect a border ; you will even be able to select the color. Make it IBDesignable and make the border @IBInspectable, so that you can edit in inspector.
Did this solve your problem ?
It haven't tried your solution. I found an easier one from another source. There is a property to set the border on the label control that's not accessed directly on the label object but is a property on a property of the label object.
thanks for the feedback.
Here's the answer I got somewhere else.
button.layer.borderWidth = 2.0
button.layer.borderColor = UIColor.cyan.cgColor