ibdesignable

IBDesignable never finishes updating UITableViewCell in storyboard

六月ゝ 毕业季﹏ 提交于 2019-12-03 06:52:07
This is a similar question to this but not quite the same. I have created a subclass of UITableViewCell which references a custom nib and marked it as @IBDesignable. Changes that are made both in code and from the .xib file display correctly in the simulator and on a device but not in the storyboard. import UIKit @IBDesignable class TextFieldTableViewCell: UITableViewCell { var view: UIView! required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) setup() } override init(style: UITableViewCellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier:

Make a fixed size UIView, like UISwitch (using IBDesignable)

荒凉一梦 提交于 2019-12-03 05:44:15
When I'm using this guide to create a view that is designed in a XIB, reusable from within a storyboard using the IBDesignable attribute on my UIView subclass, how do I make it have a fixed size, and have its resizing behavior match that of a view like UISwitch? With "resizing behavior" I also mean while designing in interface builder. You could override intrinsicContentSize() in your UIView subclass. Then you won't need to supply height and width constraints in the interface builder. override var intrinsicContentSize: CGSize { return CGSizeMake(width: 100, height: 100) } If you only want to

IBDesignable Build Failed

谁说胖子不能爱 提交于 2019-12-03 04:48:47
I have Created IBDesignable and IBInspectable custom class to give shadow and corner radius for view But When I assign Designable class to view , I get Designable Build Failed This is my code import Foundation import UIKit @IBDesignable class DesignableView: UIView { } @IBDesignable class DesignableButton: UIButton { } @IBDesignable class DesignableLabel: UILabel { } @IBDesignable class DesignableTableView: UITableView { } extension UIView { @IBInspectable var cornerRadius: CGFloat { get { return layer.cornerRadius } set { layer.cornerRadius = newValue } } @IBInspectable var borderWidth:

Can you add IBDesignable properties to UIView using categories/extensions?

跟風遠走 提交于 2019-12-01 02:25:30
For those that don't know what I'm talking about, Xcode 6.0 added new features, IBDesignable and IBInspectable. When you tag your custom views with IBInspectable properties, those properties show up in the Attributes Inspector in IB. Likewise, when you tag a custom UIView subclass with IBDesignable, Xcode compiles your views and invokes the code to render your view objects right in the Xcode window so you can see what they look like. The technique for adding IBDesignable and IBInspectable attributes to custom views is pretty much identical in Swift and Objective-C. IBInspectable properties

how to make Designable UIImage in Swift

痞子三分冷 提交于 2019-12-01 01:14:57
I am a beginner. I want to make a swift file that contains a code to make Designable UIImage, so I will not edit the UI element display by coding, just in Interface builder by assigning this swift file to UI class. I can do something similar in UIButton, for example if i want to make round corner and add border to UIButton i can do something like this import UIKit @IBDesignable class DesignableButton: UIButton { @IBInspectable var cornerRadiusOfButton : CGFloat = 0 { didSet { layer.cornerRadius = cornerRadiusOfButton } } @IBInspectable var borderWidth: CGFloat { set { layer.borderWidth =

how to make designable textfield code class in swift

断了今生、忘了曾经 提交于 2019-11-30 20:36:10
问题 I am a beginner in programming and in iOS development. I want to make a swift file that contains a code to make Designable textfield, so I will not edit the UI element display by coding, all the UI that will be edited, I will edit it in Interface builder. I need to input an image in UITextfield, and I follow along a tutorial in here https://www.youtube.com/watch?v=PjXOUd4hI6U&t=932s to put an image in the left side of the UITextField, like the lock image in the picture above. here is the the

Live Rendering a custom component using IB_DESIGNABLE from a pod dependency

做~自己de王妃 提交于 2019-11-30 12:37:03
问题 I'm having some difficulty using IB_DESIGNABLE in a pod. I created a custom view which I marked as IB_DESIGNABLE and made a sample project that uses it. No problems so far. The issue happens when adding that custom view as a pod dependency. Although the project builds and runs successfully, there is an error when the storyboard that uses the custom view is opened. The Live Rendering process starts and tries to show the view live inside Interface builder but it fails with the following error:

Configuring @IBInspectable Attribute Inspector controls

点点圈 提交于 2019-11-30 11:48:44
Is it possible to configure how @IBInspectable properties are displayed and/or controlled in the Attribute Inspector? For example, I have a CGFloat property "Overlay Alpha" which shows up in the inspector like this: The problem is that the adjustor up/down arrows only update in integral (+/- 1) steps. I want them to update in small steps, say, +/- 0.05 increments. Is there any way to do that? How about other properties of the controls? Can you display a slider for a CGFloat instead of a numeric field? Can you add a tooltip? Can you add static descriptive text? Just wondering how much I can

Failed to render instance of ClassName: The agent threw an exception loading nib in bundle

两盒软妹~` 提交于 2019-11-30 08:20:35
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 layout status: The agent raised a "NSInternalInconsistencyException" exception: Could not load NIB in bundle: 'NSBundle (loaded)' with name 'StripyView' Here's the code I use to load the nib: override init(frame: CGRect) { super.init(frame: frame) loadContentViewFromNib() } required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) loadContentViewFromNib() } func loadContentViewFromNib() { let

IB Designables: Failed to render and update auto layout status

社会主义新天地 提交于 2019-11-30 06:24:46
问题 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: UIView! @IBOutlet weak var userButton: UIButton! override init(frame: CGRect) { super.init(frame: frame) load() } required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) load() } fileprivate func load() { Bundle.main.loadNibNamed("UserView", owner: self, options: nil) addSubview(view)