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
1
vote
1 answer

@IBInspectable in Swift 4.0

While migrating to Swift 4.0, I am facing an issue with @IBInspectable, open class SVContactBubbleView: UIView { @IBInspectable open var dataSource: SVContactBubbleDataSource? //ERROR..!! @IBInspectable open var delegate:…
PGDev
  • 23,751
  • 6
  • 34
  • 88
1
vote
2 answers

How to change the cornerRadius of button from storyboard with custom IBDesignable class created

The class given below is working fine @IBDesignable class iButton : UIButton { @IBInspectable var cornerRadius : CGFloat = 0.0{ didSet{ layer.cornerRadius = cornerRadius } }} But question is, when i set cornerRadius value 35 in…
Hurdler
  • 7
  • 3
1
vote
1 answer

Passing selector via IBInspectable in Swift 3

I created a custom control and I want to pass the action in an @IBInspectable property to achieve the same effect of setting up an @IBAction using UIButton. How should I go about doing this? class MyControl: UIButton { // Problem with this string…
Boon
  • 40,656
  • 60
  • 209
  • 315
1
vote
0 answers

Add Range to `IBInspectable` attribute

According to Apple docs, we can add these types to IBInspectable attribute. Render and inspect your custom views You can add the IBInspectable attribute to any property in a class declaration, class extension, or category of type: boolean, integer…
Sahil
  • 9,096
  • 3
  • 25
  • 29
1
vote
2 answers

How to create segment control like IBInspectable properties?

I want to create custom control like segment control But i'm not able to understand how to create this kind of Segment IBInspectable properties. i mean it's elements increasing according to Segments. as i know there is no support of array in…
Sahil
  • 9,096
  • 3
  • 25
  • 29
1
vote
2 answers

Create a OptionSet that is usable with IBInspectable

I'm trying to create a OptionSet which can be used in combination with @IBInspectable It seems like this was possible in Swift 2.2 I came across this library which seems to be using an OptionSet in combination with @IBInspectable (The IBInspectable…
NoSixties
  • 2,443
  • 2
  • 28
  • 65
1
vote
1 answer

IBInspectable does not work for Int or UInt

@IBInspectable var numLines:UInt! = 2 The above code shows a message Failed to set (numLines) user defined inspected property UIViewNewClass [setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key numLines. It…
NNikN
  • 3,720
  • 6
  • 44
  • 86
1
vote
1 answer

CALayer with Animated Path Content, Make Inspectable/Designable

I made a custom circular progress view by subclassing UIView, adding a CAShapeLayer sublayer to its layer and overriding drawRect() to update the shape layer's path property. By making the view @IBDesignable and the progress property @IBInspectable,…
Nicolas Miari
  • 16,006
  • 8
  • 81
  • 189
1
vote
2 answers

how to write custom IBInspectable for fonts and direction?

I decide write extension for text field in swift, and add some feature to UITextField for example add label, title, direction for title, custom color, custom font for title and etc. The RTL Language direction number (for example phone number) in the…
Ali ZahediGol
  • 876
  • 2
  • 10
  • 20
1
vote
0 answers

How to delimit values on IBInspectable values

Is there a way to delimit values on IBInspectable var or change how much the value increases or decreases? For example, suppose that I have the following var: @IBInspectable public var percentage:CGFloat = 0.0 I want to delimit from 0.0 to 1.0. I…
kobuchi
  • 420
  • 5
  • 11
1
vote
0 answers

Set increase or decrease step with @IBInspectable

I have customized a progress view with @IBDesignable and @IBInspectable. When I clicked the increase button, it alway increase 1 . Can I set it increase anyother number?
ZeroChow
  • 422
  • 2
  • 5
  • 16
1
vote
1 answer

IBInspectable and default values in objective-c, black coloured view

I'm using IBInspectables in my objective-c project. I wan't to set some default value for these. It's not a simple as just setting a default value like you can in swift so I'm trying to do it in the init method like so: @interface PushButtonView…
Kex
  • 8,023
  • 9
  • 56
  • 129
1
vote
1 answer

@IBInspectable list of UIColors?

I am trying to make a GradientView that is adjustable in Interface Builder. I've been able to get it so I can specify vertical vs horizontal, as well as start/stop colors: I would like to be able to be able to include intermediate colors as well.…
Travis Griggs
  • 21,522
  • 19
  • 91
  • 167
1
vote
1 answer

IBInspectable property set at design time not keeping value

We are in the process of implementing IBInspectable into a large app in hopes of allowing some settings to be set in Interface Builder to reduce the amount of code in our views. I don't have much experience with IBInspectable/IBDesignable and am…
Pheepster
  • 6,045
  • 6
  • 41
  • 75
1
vote
1 answer

IBDesignable UIButton IB Render without IBInspectables

I have below code to create a custom IBDesignable UIButton. Note that I do not have any IBInspectables since I do not need any. I want all my custom buttons to be same. import UIKit @IBDesignable class ShButton: UIButton { required init(coder…
Kashif
  • 4,642
  • 7
  • 44
  • 97
1 2 3
8 9