ibdesignable

Configuring @IBInspectable Attribute Inspector controls

╄→尐↘猪︶ㄣ 提交于 2019-12-18 14:45:29
问题 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

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

醉酒当歌 提交于 2019-12-18 09:07:08
问题 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

Failed to render instance of IB Designables

天涯浪子 提交于 2019-12-17 17:26:22
问题 I have an Objective-C and Swift mixed dynamic framework. And the mixed framework was linked with two pure Objective-C dynamic frameworks. When I tried to mark any class in the mixed framework with IB Designable and using that class in either storyboard or nib, the Xcode always says the instance of it was failed to render. And there was the error message: IB Designables: Failed to render instance of WZUITokenField: dlopen(WZUIKit.framework, 1): Library not loaded: /Library/Frameworks

how to make Designable UIImage in Swift

a 夏天 提交于 2019-12-12 07:25:29
问题 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

invalid context 0x0 within custom UIView

允我心安 提交于 2019-12-11 14:23:33
问题 I have the following code for a custom view. @IBDesignable class SplitCircleView: UIView { override init(frame: CGRect) { super.init(frame: frame) draw(frame) } required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) draw(frame) } override func draw(_ rect: CGRect) { self.backgroundColor = .clear drawSlice(rect: self.frame, startPercent: 87.5, endPercent: 37.5, color: .green) drawSlice(rect: self.frame, startPercent: 37.5, endPercent: 87.5, color: .red) } func drawSlice(rect:

@IBInspectable not updating Story Board

≡放荡痞女 提交于 2019-12-11 12:23:01
问题 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 just shows the button without applying the transformation. It doesn't matter if I do the transformation inside the drawRect method - same result. import Foundation import UIKit @IBDesignable class CustomButton: UIButton { @IBInspectable var rotation: CGFloat = 0.0 { didSet { self.transform =

How to create segment control like IBInspectable properties?

强颜欢笑 提交于 2019-12-11 04:29:19
问题 I want to create custom control like segment control But i'm not able to understand how to create this kind of Segment IBInspectable properties. i mean it's elements increasing according to Segments . as i know there is no support of array in @IBInspectable . 回答1: You can't create that type of @IBInspectable (yet), but... You can define a String variable as an @IBInspectable var, and add multiple lines to it. Then have a didSet method split the string into an array which you use internally

IBDesignable view not rendering

别来无恙 提交于 2019-12-10 23:37:34
问题 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 func draw(_ dirtyRect: NSRect) { super.draw(dirtyRect) NSColor.red.setFill() NSBezierPath(ovalIn: bounds).fill() } } When I run the app, this view appears fine. But this designable view is not rendered in my scene in Interface Builder: Note, this problem only manifests itself when the view in question

Is it possible to use IBDesignable with UICollectionViewCells and live render them in storyboard?

假如想象 提交于 2019-12-10 13:56:08
问题 I know how to use @IBDesignable with custom views. but is it possible to use IBDesignable for cells and render them in storyboard? for example: i have a collectionViewController in storyboard, and added a uiCollectionCell and specified class as my customCellClass. p.s: i know for using Xibs in collecionViews and tableViews we have to call method registerNib:forReuseIdentifer in code (and i am doing it). just wondered, is it possible to see it's rendered view in storyboard or not. p.s2: i

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

蹲街弑〆低调 提交于 2019-12-10 13:17:07
问题 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 "titleText" which is supposed to update the main view using this framework. Issues are: Interface Builder not updating the titleLabel? (i.e. at design time) i.e. I'm expecting that this should, just like it is working for the "layer" items. At Run