I want to set the border of a UITextView
or a UILabel
in a Storyboard.
Can it be done?
Programmatically, it is setBorderColor
and setBorderWidth
.
But can the border be set in a Storyboard?
I want to set the border of a UITextView
or a UILabel
in a Storyboard.
Can it be done?
Programmatically, it is setBorderColor
and setBorderWidth
.
But can the border be set in a Storyboard?
As was previously pointed out, these properties are part of a layer, not part of a view. But you can still set their values in IB. As hypercrypt pointed out, you can use User Defined Runtime Attributes. Since all views have a "layer" property, you can set "layer.borderWidth" for instance.
Here's a case, where I'm changing the cornerRadius. Works great.
use simple code in .m,it show border in view
view.layer.cornerRadius = 5.0f;
view.layer.masksToBounds = NO;
view.layer.borderWidth = .5f;
view.layer.shadowColor = [UIColor orangeColor].CGColor;
view.layer.shadowOpacity = 0.4;
view.layer.shadowRadius = 5.0f;
If you're targeting iOS 6+ you can use the User Defined Runtime Attributes in the Identity Inspector to set any properties. Performance is not an issue for either, so it doesn't matter.