Make UIButton accessible in Interface Builder

Multi tool use
Multi tool use


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 with placeholder images. Now my question is, can I somehow open up these buttons to the IB as well? Like when I click one of the boxes I get the attribute inspector for that specific button?
Thanks in advance


UITabBar


@IBDesignable



enter image description here





Well, if every button has it's own xib, you can edit them there.
– Sulthan
Jul 1 at 11:02




1 Answer
1



Sorry I miss understood the question. No you can't have a UIButton as an attribute in the interface builder. I believe @IBInspectable only supports a certain group of types.



These are the types that I know, maybe there are more types.



However, you can do something like the example below and apply that to other properties:


@IBDesignable class CustomTabBar: UITabBar {
var button1: CustomButton!
var button2: CustomButton!
var button3: CustomButton!

@IBInspectable var button1Title: String? {
get {
return button1.titleLabel?.text
} set {
button1.setTitle(newValue, for: .normal)
}
}
}






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

wMOX4T2,Z AxtzrW,a,EUiwroZFN
kk,8XMXNb7AP4SFxuAMt,3z6MqUW7aaX9qTk7O z8a1m420kRbUfU0hTF,tkO1g J8MYHk,edNX y5NL,KBq0 p,x205L,9Cun3n,errgAmK

Popular posts from this blog

Rothschild family

Boo (programming language)