Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Interface Builder Custom Styles?

Simple question. Does anyone know why Interface Builder doesn't allow for applying custom styles on UI elements? Why is it only possible to do this programmatically?

I can see how this might be difficult for custom UIView subclasses but the default controls definitely only have a tiny subset of the style options available through IB, such as background color or changing font colors. Why is this the case? Is there any way to approach a concept like application themes through IB?

like image 222
donalbain Avatar asked Sep 22 '11 00:09

donalbain


3 Answers

My personal feeling is that Apple does this right. They provide the elements and styles that fit the HIG. If they start adding other elements/styles then where do the start, and where do they draw the line?

Also, it isn't like Apple actively prevents using custom elements/styles, they just don't include it in the tool set.

The last thing we need is a tool set full of bloat.

like image 99
sosborn Avatar answered Nov 04 '22 08:11

sosborn


You'd really have to ask Apple as to the why. I'd guess that it's some combination of promoting consistent use of standard interface elements and limited development resources.

You can, of course, build interfaces using your own custom subclasses of the standard interface elements in IB. It's a little more work, since you have to change the type of each object you add from UIButton to MyGreenButton or whatever, but it's not difficult.

It's also not hard to imagine coming up with a controller-type class that could connect to all your controls and whatnot to customize their appearance in some consistent, theme-like manner. Add an instance of that to each nib, connect all the controls, and let it do it's thing. You wouldn't see the effect until you actually run the app, of course, but it sounds like you're talking about customizing colors and fonts rather than size.

like image 27
Caleb Avatar answered Nov 04 '22 07:11

Caleb


Unfortunately you are at the mercy of the Almighty Apple Deity..... Bow at their feet and give thanks that you have what they give you..... lol...

Seriously tho. Apple puts in what apple wants and you can request additions, but the IB is fairly minimal in the way of features.

I think this may be by design. Somehow an Elegant Simplicity ?

The ability to customize the controls is given to the programmer however I think they want the controls standardized. I just dont know why they didnt give a little more variety in the controls that are available. Like a few more button styles for the ios devices...

If you find out otherwise I would definitely be all ears.

like image 1
The Lazy Coder Avatar answered Nov 04 '22 07:11

The Lazy Coder