top | item 4878533

NUI: style your iOS app with style sheets

85 points| jamesjyu | 13 years ago |github.com | reply

28 comments

order
[+] borgopants|13 years ago|reply
A really interesting project which I feel might make web developers more comfortable with iOS development.

As an iOS developer however, I find that using Interface Builder or pure code is much more flexible and simpler to use than a CSS stylesheet.

[+] wlue|13 years ago|reply
A strategy that I found works really well to quickly style everything is to create a category on UIView that defines a block property decorated with UI_APPEARANCE_SELECTOR, then on the setter, invoke the block. Then set the appearance proxy on app startup:

  [[UILabel appearance] setStyleBlock:^(id view) {
    UILabel *label = view;
    label.backgroundColor = [UIColor clearColor];
  }];
The advantage is that you can style properties that aren't supported by UIAppearance natively, since a block just gets run when the view is ready to be styled. You also can style subviews from the same block (ie. title label inside of a warning view should be red and bold).
[+] kreutz|13 years ago|reply
[+] pooriaazimi|13 years ago|reply
I was very excited about Pixate when I followed your link, but after the initial excitement it turned out that it's one of those stupid MVP (potentially) vaporwares that's just a cute landing page with a form for "give us your email so we can let you know when it's available" in the signup/download link... It's a concept, not a product. And for all we know, it could take a year or two before it's released. Yet, the landing page makes you believe you can use it today:

"Long gone are the days of tedious image slicing [..]. With Pixate, designers and developers alike can conceive, [..]. etc., etc."

I really hate such "tricks". If it's a concept, just say so in the landing page - we won't kill you! We will find out in the end - it's hardly a secret, and will be pissed when we click "Download SDK Now!" and find out it's in the early stages of development...

I might've been interested in backing them up on KickStarter, but I really don't trust them now (because of this trick they pulled on me). What if their framework has a serious bug (a severe memory leak)? Can I trust these guys to tell me so if I build my (imaginary) $50,000 app using their framework? No, I don't feel that confident.

[+] bradfol|13 years ago|reply
I would be very interested to know how this compares to Pixate.

Pixate appears to be a large project and very ambitious, so I am surprised to see NUI appear, seemingly out of nowhere.

[+] bengl3rt|13 years ago|reply
I'm really glad this is open source. I intend to make use of it in any new apps I start, and contribute back any bug fixes or improvements.

As it happens, I was going to build something like that for an app I'm due to start tomorrow, but now I don't have to.

[+] pdenya|13 years ago|reply
I'd use something like this if it was built by apple but I can style apps quickly enough as is without going out of my way to implement this.

As others have mentioned it's not really a "drop-in solution" and it doesn't look to be much faster than just creating categories that return styled objects you need eg: [UIButton greenButtonWithText:@"Sign up"]; [UILabel headerLabelWithText:@"etc, etc"];

[+] josephlord|13 years ago|reply
Looks good I may use it. Looks like you are using the MIT license which is nice and permissive but could I suggest that you leave the heading ("The MIT License") in so that people can see at a glance that it is that.

That assumes that you haven't changed the licence at all.

[Edit: License does seem unchanged. I've sent a Pull request if the creator does want to make this change.]

[+] frankus|13 years ago|reply
The Three20 guys tried something similar a few years back: http://three20.info/extension/extCSSStyle.

It's a pretty neat concept, particularly if you have web content that needs to be styled in coordination with your app's chrome.

[+] kyle_martin1|13 years ago|reply
I REALLY want something like this. Like the others said, it must use appearance proxies whenever possible. I literally want to add the source files, edit the .nss file and it works.
[+] supercoder|13 years ago|reply
It's hardly a 'drop-in' solution if you have to change all your UI views to inherit from the NUI equivalents.

I could never use this based on that requirement.

[+] RandallBrown|13 years ago|reply
I wonder if something could be done with the appearance proxy, or even something as simple as a #define from UIView to NUIView in the pch, that would make this even more drop in.
[+] shawn-butler|13 years ago|reply
Could use categories rather than subclassing at first glance.

Of course, usually my first glances are wrong.

[+] eclipxe|13 years ago|reply
[NUIRenderer renderButton:myButton];
[+] max81|13 years ago|reply
Hm, I see NUI uses method swizzling, which in fact a potential reason for app rejection.
[+] dia123|13 years ago|reply
Wow super cool - i wonder if it works with ruby motion? I don't know why it wouldn't.