Questions tagged [ibinspectable]

IBInspectable is a keyword that enables a property to be set from Xcode Interface Builder.

IBInspectable is a keyword that enables a property to be set from Xcode Interface Builder.

Sample Objective-C usage:

@property IBInspectable float myCustomProperty;

Sample Swift usage:

@IBInspectable public var myCustomProperty:float = 1.0

See also:

131 questions
4
votes
1 answer

UIButton Border Color on Selected State using IBInspectable

I am using @IBInspectable to set a border color on a UIButton using a Swift extension like this: extension UIButton { @IBInspectable var borderWidth: CGFloat { get { return layer.borderWidth } set { layer.borderWidth =…
Clifton Labrum
  • 13,053
  • 9
  • 65
  • 128
4
votes
1 answer

IBInspectable and protocols

I'm using new Xcode 6 feature called "LiveRendering". As i need to use some inspectable properties a lot on different custom views, i want to declare them in protocols. For example : LiveRenderingTextAttributesProtocol (that declares inspectable…
QLag
  • 823
  • 1
  • 13
  • 33
4
votes
3 answers

IBInspectable setTitle:forState on UIButton not working

I'm trying to implement a localizable class for UIButtons using live rendering in the Interface Builder. This is the code I have so far: @IBDesignable class TIFLocalizableButton: UIButton { @IBInspectable var localizeString:String = "" { …
Antoine
  • 23,526
  • 11
  • 88
  • 94
4
votes
1 answer

Xcode 6 @IBInspectable: Initialize to starting value?

When you add @IBInspectable properties, they are initialized to essentially... nothing. Is there a way to have these properties default to something? Say a red color for the track color, grey color for the background color and 10.0 for padding?…
RyJ
  • 3,995
  • 6
  • 34
  • 54
3
votes
1 answer

@IBInspectable property doesn't show up in Interface Builder

I have a class like this, and this IB doesn't show the property foo1 in inspection pane. @IBDesignable final class Foo: UIView { @IBInspectable var bar1 = CGFloat(0) } What's wrong? (Xcode 10.1)
eonil
  • 83,476
  • 81
  • 317
  • 516
3
votes
1 answer

How does the interface builder decide when a separator will be introduced when using IBInspectable

Right now I'm creating a custom view and I'm wondering how the interface builder decides when a line is introduced. as you can see it divides it into 3 sub groups However I'm wondering how it is decided where a subgroup starts and ends. Because…
NoSixties
  • 2,443
  • 2
  • 28
  • 65
3
votes
4 answers

Circular UIView Not A Full Circle

I have an interesting issue, but I'm not sure how to solve it. I am attempting to extend UIView with an @IBInspectable. However, with this method the corner radius seems to be set from the nib files default side, not the actual size of the view.…
steventnorris
  • 5,656
  • 23
  • 93
  • 174
3
votes
1 answer

IBDesignable rendering NSLayoutConstraint subclass

I have develop a DeviceLayout Library enter link description here this library provide DeviceLayoutConstraint to set AutoLayout constant per device size import UIKit import Device class DeviceLayoutConstraint: NSLayoutConstraint { …
Cruz
  • 2,602
  • 19
  • 29
3
votes
2 answers

Set IBInspectable programmatically

I would like to set different IBInspectable items based on internet information I get. For example, I have IBInspectables for green, red and orange circles. If the request says green, I would like to set isGreen inspectable to Yes, and others to no.…
Dragos Strugar
  • 1,314
  • 3
  • 12
  • 30
3
votes
0 answers

Can IBDesignable and IBInspectable run on iOS7 phone?

I'm using Xcode7.1, and used @IBDesignable and @IBInspectable to custom a view. When I set the Deployment Target to iOS7.0, the property I set with IBInspectable didn't work. Does it work on iPhone with iOS7.0?
ZeroChow
  • 422
  • 2
  • 5
  • 16
3
votes
2 answers

@IBInspectable: wrong bounds and frames at runtime when I add subviews

This is my @IBInspectable: code: @IBDesignable class PBOView: UIView { @IBInspectable var borderRightColor: UIColor? { didSet { let borderRightView = UIView(frame: CGRectMake(frame.size.width - 10, 0, 10, frame.size.height)) …
Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358
3
votes
1 answer

iOS. Interface Builder @IBInspectable crashes

I'm trying this IBDesignable. But as always it don't work. My controller code: @IBDesignable class MainMenuViewController: UIViewController { @IBOutlet weak var languagesButton: UIView! @IBOutlet weak var keyboardSettingsButton: UIView! …
Vasyl Khmil
  • 2,548
  • 1
  • 20
  • 36
2
votes
0 answers

Set UIView Border Color or width in swift using @IBInspectable

@IBDesignable extension UIView { @IBInspectable var borderColor: UIColor? { set { layer.borderColor = newValue?.cgColor } get { guard let color = layer.borderColor else { return…
Tapan Raut
  • 850
  • 6
  • 17
2
votes
1 answer

Xcode - Is there a way to disable all IBInspectable temporarily, to speed up Storyboard?

I really like IBInspectable and IBDesignable features, that allow to speed up things and have a better view of final result, directly in Storyboard. But Gosh…they slow down soooo much my storyboard loading, and makes it very laggy every time I edit…
AnthoPak
  • 4,191
  • 3
  • 23
  • 41
2
votes
2 answers

IBInspectable variable value is not changing in interface builder and simulator

I am creating custom parallelogram view and view is rendering fine with default offset value. But when i change the offset value from ib it's not working @IBDesignable class CustomParallelogramView: UIView { @IBInspectable var offset: Float =…
azhar
  • 1,709
  • 1
  • 19
  • 41
1 2
3
8 9