Questions tagged [ibdesignable]

IBDesignable is a designation given to views in Xcode 6 that allows them to be rendered directly in Interface Builder without the need to build and run the application.

279 questions
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
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
0 answers

Interface builder Designables started failing

I have some IBDesignables in my storyboard. These Designables worked perfectly yesterday... but now when I open the storyboard all Designables fails to build >:( Ive tried: refreshing all views: Editor->Refresh All Views restarting…
Arbitur
  • 38,684
  • 22
  • 91
  • 128
4
votes
1 answer

Loading code from a framework for a custom control in IBDesignable

I've implemented a custom control in a OS X application that works fine. When the control is drawn it uses code from a non system Framework. The control is written in swift, the framework is in Objective-C. The Framework is not built in the same…
SheffieldKevin
  • 271
  • 1
  • 13
4
votes
1 answer

IB_DESIGNABLE makes Xcode stop responding when leaving storyboard

Xcode 6 introduced IB_DESIGNABLE and IBInspectable. I'm quite a late bloomer, and discovered this 3 days ago. I thought it would be handy, when creating or using custom view, but I do have a huge problem: IB_DESIGNABLE makes Xcode stop working. I…
Redwarp
  • 3,221
  • 3
  • 31
  • 44
4
votes
1 answer

Misplaced view warning and odd behavior with IB_DESIGNABLE custom view using auto layout

I create a custom IB-designable view (see code below) which renders correctly in IB and also works fine when running it. However, in get this warning about the view being misplaced and I cannot manually resize the view in Interface Builder (when…
Michael
  • 250
  • 3
  • 8
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
1 answer

IBDesignables and traitCollection in live rendering

I am building my custom UIControl, a custom button built as an IBDesignable, which needs to change based on the size class in which it is being displayed. I have a method -setupForTraitCollection, which looks like this: func…
4
votes
1 answer

IB Designables Error when using UnitTests

I am currently working on an iOS App using Xcode 6.1.1 and Objective-C. In the app there are several custom view subclasses. One of them is a subclass of UIButton, another one is a subclass of UIView. Those custom views are marked as IB_DESIGNABLE…
naglerrr
  • 2,809
  • 1
  • 12
  • 24
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
4
votes
3 answers

Live Xcode's Interface Builder UIView subclass (IB_DESIGNABLE) without drawRect:

Is it possible to create a UIView subclass that renders live in Xcode (by adding the IB_DESIGNABLE attribute as explained here) but doesn't have a custom drawRect: method? We have a custom UIView subclass that uses some CAShapeLayers which are added…
Ricardo Sanchez-Saez
  • 9,466
  • 8
  • 53
  • 92
3
votes
0 answers

How to show IBInspectable of sub component in custom view?

I have a custom view that have a label and text field and was connected to my nib file. I want to edit them using attribute inspector, but the only component that I see on the attribute inspector was the parent UIView How can I show the whole…
Dylan
  • 1,121
  • 1
  • 13
  • 28
3
votes
1 answer

UIAppearance overwrites custom textColor on UILabel

I setup UILabel appearance in my app delegate using: UILabel.appearance().textColor = UIColor.white I also have a custom UIView subclass that contains a UILabel along with some other elements (omitted here): @IBDesignable class CustomView: UIView…
BlackWolf
  • 5,239
  • 5
  • 33
  • 60
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