Reputation: 3105
I have created an app which uses the storyboard feature in Xcode.
I need to put a button on a few views which is a "Call us" button. The button will have the same look, text and action associated with it.
It's that reason which I thought would be best to create a subclass of the button and set all the button properties from there.
There are no coding problems, but when I drag on a button to a view on the storyboard, change it's class to the "CallButton" subclass name - it simply ignores all the formatting.
Am I missing something? Is there an easier way to reuse a button? Normally (old school way) I would simply call the button from the code, but as I've used the storyboard, I need to drag and drop the button really.
Thanks for any advice!
Upvotes: 2
Views: 1441
Reputation: 2226
Xcode wont reflect the changes you make programatically in your subclass, but if you're setting up the buttons look in your subclass it should look as expected when you run the application.
Ideally you would setup your CustomButton in its initWithFrame and initWithCoder methods.
Upvotes: 2