All Questions
Tagged with ibdesignable interface-builder
75 questions
0
votes
0
answers
313
views
How to use color sets in designable views in storyboards?
The situation and steps to reliably reproduce:
Set up a macOS app project with Swift and storyboards for UI in Xcode.
Define an arbitrary color for the "AccentColor" color set in the asset ...
5
votes
1
answer
855
views
IBDesignable UIView Subclass Always Fails to Render in Interface Builder
I see a number of questions about this, but few answers (one answer solved a previous similar issue, but not this one).
THE PROBLEM
I have an IBDesignable class. It derives from UIControl, but the ...
1
vote
1
answer
543
views
Very Strange Errors From IB During Build With Swift Package, Using IBDesignable
I have developed this shared package. It works fine.
In the package test harnesses (3 iOS apps), it works great, and also, the IB storyboard renders the control (It's an IBDesignable).
However, when I ...
1
vote
1
answer
1k
views
Trouble with IBInspectable and loading a view from xib for Interface Builder
I have a custom class with its own .xib. I'm trying to incorporate IBInspectable to change the color of its background and subviews' backgrounds in IB.
In IB, when I leave 'Custom Class' blank, and ...
2
votes
1
answer
158
views
Is there a way to make a custom constraint work in interface builder?
Make a UIView with a fixed height constraint, notice I set it to say 40 in IB.
Change the constraint class to this:
@IBDesignable class BadassHeightConstraint: NSLayoutConstraint {
override var ...
1
vote
1
answer
316
views
constraints in prepareForInterfaceBuilder?
I'm no great fan of @IBDesignable, but in playing around with it I find that if you add a subview in prepareForInterfaceBuilder, the subview is added but constraints that you apply to it are not ...
0
votes
2
answers
256
views
How to show image on custom button control in designer
I have a custom button control where I am trying to show an image for the button but it is not appearing despite defining it programatically.
@IBDesignable class UCButtonNext: UIButton {
// ...
0
votes
1
answer
128
views
What's the right method to override in an IBDesignable view so it shows up in the Interface Builder?
I am building some IBDesignable views (by code) and I want them to be available in the Interface Builder with the custom changes I’m doing in the *.swift view class. In that case, what is the best ...
3
votes
1
answer
371
views
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 (...
3
votes
1
answer
366
views
@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....
0
votes
0
answers
108
views
How can you give design-time layout support to a custom UIView?
Just playing around to see if something can be done. I know I can give design-time support to certain properties by adding @IBInspectable to them, and I'm also aware of making the view itself support ...
2
votes
0
answers
57
views
At which order Interface Builder evaluates IBInspectables?
I have custom UI element designed with a help of IBInspectables, so that I can use and modify it in the Interface Builder. There are 2 inspectables which effectively change the same property of the ...
9
votes
2
answers
2k
views
Using named colors from asset catalogue in IBDesignable Views crashes IB even when specifying the Bundle
When referencing a colour that has been created using UIColor(named:) Interface Builder crashes due to it finishing nil for the colour.
Initially I thought this would be as IB was looking for the ...
0
votes
1
answer
214
views
Make UIButton accessible in Interface Builder
I'm working on a little project which adds a little bar on the bottom of the screen, similar to UITabBar (see screenshot below). It's an @IBDesignable class. The blue boxes you can see are buttons ...
0
votes
1
answer
795
views
IBDesignable with CollectionView crashes when add value to DataSource
I am working on a small UIView component that displays hashtags in a UICollectionView and for some reasons I needed to make it "editable" through the Interface Builder... Therefore, I made it ...
5
votes
0
answers
913
views
IBDesignable Not Working on Large Xcode Project, Works on Proof-of-Concept
I'm working on a project with 100+ source files. I decided to implement a reusable custom view whose layout I can preview on Interface Builder, as described in this question and many others.
However, ...
1
vote
2
answers
954
views
xcode Interface Builder not updating IBDesignable class
In my project, I have several custom class files based on UITextField and UIButton.
As an example, the UITextField class looks like this:
import UIKit
@IBDesignable class RoundedTextField: ...
35
votes
14
answers
42k
views
IB Designables: Failed to render and update auto layout status
I have a custom view (xib) that has a UIButton inside of it, I made id IBDesignable doing the following:
UserView.swift
import UIKit
@IBDesignable
class UserView: UIView {
@IBOutlet var view: ...
1
vote
1
answer
1k
views
iOS @IBDesignable autorefresh UILabel params as title, font, color
I'm working on a feature, that I can set my custom style on UILabel (by taping name of style). I have a simple code for this:
struct Style {
var fontName: String!
var fontSize: CGFloat!
...
1
vote
1
answer
609
views
No preview of custom UIStackView in Storyboard despite using IBDesignable
I don't know what's causing the problem but I can't see the preview of my custom element in .storyboard file. When I run it on the device it is here and works fine (looks the same as my .xib file), ...
1
vote
2
answers
675
views
view.frame is not set when IBDesignable loads xib
I have a simple UIView subclass that I have made @IBDesignable.
I overloaded init frame and init coder. My code loads the view description from a .xib file.
After the .xib file has been loaded I try ...
2
votes
1
answer
980
views
Swift 3: Designable table view cell
I'm having some trouble with visualise my custom table view cell in the interface builder.
Does anyone know how to make a @Designable table view cell?
When I import my custom table view cell in a ...
3
votes
0
answers
701
views
Update constraints for IBDesignable
I have a @IBDesignable UIView (ContainerView) that has one subView (also @IBDesignable). I would very much like to be able to update the constraints of the subView in the code in a way were they are ...
2
votes
2
answers
4k
views
How to create IBDesignable custom view?
I am still improving my programing skills in iOS(Swift). Today I am thinking about creating a UIView subclasses in a good way. I want to create custom view which is:
@IBDesignable - I want to see a ...
3
votes
1
answer
581
views
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 ...
2
votes
1
answer
956
views
@IBDesignable not showing background color in IB
I have a UIView as below:
import UIKit
@IBDesignable
class CHRAlertView: UIView {
@IBOutlet var icon:UILabel!
@IBOutlet var alertText:UITextView!
override init(frame: CGRect) {
...
0
votes
2
answers
2k
views
Using @IBDesignable for a gradient view
I am using the below to create a gradient view that is visible in IB:
import UIKit
import QuartzCore
@IBDesignable
class FAUGradientView: UIView {
@IBInspectable var firstColor:UIColor = ...
0
votes
0
answers
271
views
IBDesignable element misplaced in interface builder, needs to update frames manually
I'm working on a Radio Button View, and already uploaded a test project on github at https://github.com/paulicelli/RadioButton
This is basically a subclass of a UIStackView, with a IBInspectable ...
0
votes
2
answers
2k
views
UITextView IBDesignable Padding
How do I create an IBDesignable UITextView such that I can adjust the insets of the text in interface builder? I've added inspectable properties topInset, bottomInset, etc. but now I'm having trouble ...
5
votes
1
answer
634
views
Xcode IBDesignablesAgentCocoaTouch loads CPU infinitely?
I have a .xib file with extensive usage of IBDesignable views. As view grown I noticed constant CPU load. Now, my view is really big and when I open it in interface builder, ActivityMonitor show this:
...
2
votes
1
answer
221
views
Making UIImage redraw on new position on @IB_Designable
I am creating this IB_Designable class. It is like a slider. See picture. Both elements are created with little stretchable UIImages.
I have this red square that is 66x66 pt. This square has to slide ...
1
vote
0
answers
102
views
Why does Interface Builder keep screwing up my custom view?
I only started using IB recently, so maybe this has been an ongoing problem for longer than I think, but frequently when Xcode restarts, any storyboard using one of my custom views will have the ...
0
votes
1
answer
71
views
Clean interface builder compilation
I want to use IBDesignable and IBInspectable to display some custom views. Everything worked fine until it I made some errors. I fixed them but the Interface builder still renders an old state of the ...
12
votes
3
answers
3k
views
@IBDesignable view doesn't draw background color inside Interface Builder
I'm curious why doesn't this set the backgroundColor to red?
@IBDesignable class CustomLabel: UIView {
let view = UIView()
func setup() {
backgroundColor = UIColor.red
view....
3
votes
1
answer
2k
views
IBDesignable view not rendering
I have a simple @IBDesignable view that I have specified as the base class for the top level view in a scene in my macOS storyboard. For example:
@IBDesignable
class OvalView: NSView {
override ...
1
vote
1
answer
171
views
IBDesignable NSTextField in Swift
Is it possible to have a IBDesignable NSTextField in swift like this
@IBDesignable public class CustomTextView: NSTextField {
public override func prepareForInterfaceBuilder() {
self....
8
votes
0
answers
949
views
Custom views from external framework not working in Interface Builder
I was looking for some solution to this on this site and I found this answer which don't solve my problem.
How to use custom UIView from external framework (file with extension .framework) in ...
13
votes
1
answer
1k
views
Controlling the targets Interface Builder builds for IB_DESIGNABLE / IBDesignable
I'm trying to make use of IB_DESIGNABLE in my app.
The problem is my app is huge and takes an appreciable amount of time to build (ie. many minutes), so I would like keep all my custom views in a ...
0
votes
1
answer
114
views
Custom control within framework not configurable or visible in Xcode
I have created a small selection of custom controls that are tagged @IBDesignable to enable visual configuration within IB. They work perfectly in their parent project/workspace and, as I wanted them ...
3
votes
2
answers
1k
views
IBDesignable - Arrange subviews added through interface builder
I am currently messing around with IBDesignable Views, and I am curious if anyone has been able to solve this. I would like to have views added through the interface builder be automatically arranged ...
0
votes
1
answer
193
views
UISlider - IB_DESIGNABLE - runtime attribute warning
I am trying to render a vertical slider in interface builder however, when I try to set the value interface builder gives me a warning.
What am I doing wrong here?
@IBDesignable
class ...
20
votes
2
answers
3k
views
Failed to render instance of ClassName: The agent threw an exception loading nib in bundle
When I include my custom IBDesignable view in a storyboard or another nib, the agent crashes and throws an exception because it can't load the nib.
error: IB Designables: Failed to update auto ...
2
votes
0
answers
321
views
Make Interface Builder draw IB_DESIGNABLE subviews with the currently selected size class
I have a XIB (file's owner: DesignableView) that I laid out in Interface Builder in two different size classes:
DesignableView.xib: Any | Any
DesignableView.xib: Regular | Any
I want to use this ...
9
votes
0
answers
1k
views
IB Designables: Failed to update auto layout status: The agent raised a "CALayerInvalidGeometry" exception
After I add @IBDesignable to a view controller,
import UIKit
@IBDesignable
class IvCalcViewController: UIViewController {
// ...
}
the following error shows up in Xcode 7.2 (7C68):
file:///.../...
3
votes
1
answer
712
views
Swift Protocol compilation error when using TARGET_INTERFACE_BUILDER
I am trying to generate sample data for an @IBDesignable control, so when building for IB I'm fooling the control into being its own datasource. The upshot is I'm adding some methods to a protocol ...
1
vote
0
answers
95
views
iOS IBDesignable interface builder
I have created a custom UIButton with a custom background image, font and different font size based on device(iPad or iPhone). But in the interface builder it keeps using the iPad resources when i set ...
2
votes
1
answer
730
views
@IBInspectable not updating Story Board
My custom button below works fine on the iOS Simulator - when I set a rotation in Interface Builder it rotates the button when I run the app.
However, I can't see the rotation in the Story Board - it ...
1
vote
1
answer
909
views
Can't design subview of my @IBDesignable view
I have the following:
@IBDesignable class CustomView: UIView {
@IBInspectable var hasFlag: Bool = true
var flagView: UIView?
override init(frame: frame) {
super.init(frame)
...
8
votes
1
answer
1k
views
IBDesignable and multiple targets in Swift
Seems like IBDesignable has some problems with multiple targets and swift modules. After I've added new target (my app has 2 targets now, e.g. seller and buyer), my StoryBoard began to halt views ...
6
votes
3
answers
2k
views
Is it possible to make @IBDesignable override Interface Builder values?
For example, I want to subclass UIButton and set it's font to 20.0f by default. I can write something like this:
@IBDesignable
class HCButton: UIButton {
required init?(coder aDecoder: NSCoder) {
...