ibdesignable

IBDesignable from External Framework?

柔情痞子 提交于 2019-11-30 05:09:01
I'd like to create some custom views that use the @IBDesignable and @IBInspectable tags. I have added these to my Framework and then linked my Framework to my test application. But the Designables never show up in the StoryBoard. How can I use @IBDesignable and @IBInspectable to create custom views from an external framework? Can you use @IBDesignable and @IBInspectable in an application from a non-embedded Framework? Thank you. I have found a way to use designables and inspectables with Cocoa Touch frameworks. The instructions below are for an Objective-C project and Xcode 8 (I didn't test on

Live Rendering a custom component using IB_DESIGNABLE from a pod dependency

陌路散爱 提交于 2019-11-30 03:08:02
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: This is too bad because we lose Live Rendering which is, in my opinion, one of the best features from

Loading code from a framework for a custom control in IBDesignable

旧城冷巷雨未停 提交于 2019-11-29 22:07:33
问题 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 project or workspace as the application with the custom control. I've added the Framework to the target and added it to a copy files build phase. When I add the IBDesignable decoration to the custom control class in swift then I get an error when

Stretching and kerning type, not working in Storyboard with @IBDesignable

﹥>﹥吖頭↗ 提交于 2019-11-29 16:19:23
Here is a IBLabel which tracks / stretches the font. It works perfectly in the build. But the change doesn't show live in Storyboard. // UILabel, but you can set // the tracking (that's the overall amount of space between all letters) // and streching (actually squeeze or stretch the letters horizontally) // Note: it's very common that typographers need you to adjust these. import UIKit @IBDesignable class StyledLabel: UILabel { @IBInspectable var tracking:CGFloat = 0.8 // values between about 0.7 to 1.3. one means normal. @IBInspectable var stretching:CGFloat = -0.1 // values between about -

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

那年仲夏 提交于 2019-11-29 11:35:46
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 aDecoder: NSCoder) { super.init(coder: aDecoder) self.layer.cornerRadius = 10.0 } override func awakeFromNib() { setUpView() } override func prepareForInterfaceBuilder() { super.prepareForInterfaceBuilder() setUpView() } func setUpView() { self.layer.cornerRadius = 10.0 } } But the corner radius is not showing on the button in the storyboard. I understand @IBInspectable just allows you to change the

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

跟風遠走 提交于 2019-11-29 11:23:37
问题 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

IBDesignable from External Framework?

◇◆丶佛笑我妖孽 提交于 2019-11-29 02:30:11
问题 I'd like to create some custom views that use the @IBDesignable and @IBInspectable tags. I have added these to my Framework and then linked my Framework to my test application. But the Designables never show up in the StoryBoard. How can I use @IBDesignable and @IBInspectable to create custom views from an external framework? Can you use @IBDesignable and @IBInspectable in an application from a non-embedded Framework? Thank you. 回答1: I have found a way to use designables and inspectables with

IBDesignable View Rendering times out

天大地大妈咪最大 提交于 2019-11-28 21:12:31
I've been working on an app on and off for a few months starting with the first XCode 6/iOS 8 beta release. One of my favorite features added is live rendering, made possible with the @IBDesignable tag in Swift. I haven't been able to get a single thing to live render. I figured that must have been because it was a beta release, so I decided to wait for the full release to come out to try again. It still failed. I figured then that there might be artifacts from the beta releases in my code, so I scrapped it and started fresh. It still doesn't work. Granted, the errors are slightly more

IBDesignable Errors When Adding to Tests Target

痞子三分冷 提交于 2019-11-28 20:26:49
I have a simple UIButton subclass that implements IBDesignable with an IBInspectable var: @IBDesignable class Button: UIButton { @IBInspectable var borderColor: UIColor = UIColor.whiteColor() { didSet { layer.borderColor = borderColor.CGColor } } } I am not using this within a framework and it is working in Interface Builder as intended, however, once I add this subclass to my Tests target, it stops rendering live and I get the following errors: Main.storyboard: error: IB Designables: Failed to update auto layout status: dlopen(TestTests.xctest, 1): Library not loaded: @rpath/XCTest.framework

IB Designables: Failed to render and update auto layout status

怎甘沉沦 提交于 2019-11-28 18:42:38
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) self.frame = bounds } } UserView.xib Added the UIButton and set constraints Set the File's Owner: UserView