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
7
votes
4 answers

IBInspectable with Cocoa Touch Framework not working? (code attached)

I can not seem to get the "titleText" IBInspectable attribute working. I have a simple framework view with a UILabel which I create an IBInspectable variable "titleText". I note the inspectable "layer" variables work as expected, but not my custom…
Greg
  • 34,042
  • 79
  • 253
  • 454
7
votes
3 answers

Some sort of "global" for IBDesignables?

In storyboard have a UIView, with a constraint for example "0.1" proportional height. Imagine you have a similar constraint "0.1", on views in many different scenes. Say you want to change the value 0.1 to 0.975. You have to change it individually…
Fattie
  • 27,874
  • 70
  • 431
  • 719
6
votes
1 answer

IBInspectable property doesn't have its value in initWithCoder: initializer

I am having this in MyClass.h file: #import IB_DESIGNABLE @interface MyClass : UIView @end and this is the code from the .m file: -(void)awakeFromNib{ [super awakeFromNib]; NSLog(@"This works %lud",(unsigned…
Whirlwind
  • 14,286
  • 11
  • 68
  • 157
6
votes
1 answer

How to set a max limit for an IBInspectable Int

I am using an IBInspectable Int in Swift to choose between 4 four shapes (0-3), however it is possible in the storyboard editor to set a value greater than 3 and less than 0, which stops the IBDesignable system working. Is it possible to set a min…
Harg
  • 365
  • 2
  • 18
5
votes
2 answers

How to control an UIView's rounded corners separately using @IBInspectable in Swift 3?

Here is my current code: override func viewDidLoad() { super.viewDidLoad() let rect = Draw(frame: CGRect( origin: CGPoint(x: 50, y: 50), size: CGSize(width: 100, height: 100))) self.view.addSubview(rect) }
amin sadeghian
  • 131
  • 1
  • 10
5
votes
2 answers

Want to achieve the Keyboard selection through @IBInspectable

I wanted to create a keyboard selection from @IBInspectabale How to achieve this I am creating a view, In which I insert an ImageView and a TextField, Now I am creating this custom view class as @IBDesignable and created the @IBInspectable…
nabu
  • 552
  • 5
  • 16
5
votes
0 answers

How to set default IBInspectable value for a computed property in Xcode's Interface Builder

I have a custom UIView class which has a UILabel as a subview. I want to set the font size of the label in the Interface Builder so I made a computed property fontSize that gets and sets the UILabel font's point size. @IBDesignable class…
Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
4
votes
0 answers

@IBDesignable not rendering UILabel and UITextField texts

I've created a @IBDesignable subclass of UIView The view has couple of labels and a text field. When I try to change their value in the storyboard, the changes are not rendered. In constant changes in cornerRadius, borderWidth and borderColor are…
Luda
  • 7,282
  • 12
  • 79
  • 139
4
votes
2 answers

Why IBInspectable not set vaue for optional variable from storyboard?

I am making a demo for learning how @IBInspectable works. First, I made two variables in UIViewController subclass: @IBInspectable var intTest:Int = 10 @IBInspectable var flag:Bool = false So that it appears in the storyboard. After that, I…
vikas prajapati
  • 1,868
  • 2
  • 18
  • 26
4
votes
1 answer

Create IBInspectable of unicode character

I've created some Icon Fonts using websites like (http://fontastic.me/) which gives you .ttf file. you can use it by myLable.text = "\u{e002}" // print("\u{e002}") // print("\u{1F496}") // this works nicely but I want to pass string…
4
votes
3 answers

Corner radius not showing on button in storyboard with @IBDesigable/@IBInspectable

I have this custom class for a button. import UIKit @IBDesignable class CustomButton: UIButton { @IBInspectable var cornerRadiusValue: CGFloat = 10.0 { didSet { setUpView() } } required init?(coder…
4
votes
3 answers

Interface builder agent crashes when accessing @IBInspectable UIImage

I'm implementing a custom view by subclassing UIView and using @IBInspectable for some of my variables. Two of them are UIImage. If I try to access one of them in the code, the interface builder crashes with the following…
cybergen
  • 3,108
  • 1
  • 22
  • 30
4
votes
1 answer

Generate more properties when another property's count increases

Basically, I have a view that can have an unlimited amount of UIViews inside of it. I want to be able to set self.numberOfSections = 8 or self.numberOfSections = 2 and then have that same number of UIImages generated respectively that can then be…
HannahCarney
  • 3,441
  • 2
  • 26
  • 32
4
votes
1 answer

IBDesignable not working in Objective-C

I have many reusable views designed with nibs, all of them subclasses of a class NibView class NibView: UIView { var view: UIView! func setupNib(nibName:String) { view = loadViewFromNib(nibName) view.frame = bounds …
Cristian Pena
  • 2,139
  • 1
  • 19
  • 31
4
votes
1 answer

Custom UIView with @IBInspectable func or Selector

I'm working with Swift and learning about @IBInspectable. I would like to know if it's possible create a custom view that allow other views and viewControllers to set a inner button action, as a ViewController links an IBAction directly to a button…
Viton
  • 67
  • 5
1
2
3
8 9