4 ms·
NUI: style your iOS app with style sheets
- supercoder 14y agoIt'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 14y agoI 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.
- eclipxe 14y ago[NUIRenderer renderButton:myButton];
- supercoder 14y agoYeah that doesn't really make it drop-in either though does it. The fact you have to litter you code with NUI references is a non-starter for me. They should have leveraged the UIApperance proxy. I know they have some reason about gradients or something for not using it, but that shouldnt force a compromise in the design.
- shawn-butler 14y agoCan't speak for the author but UIAppearanceProxy is iOS 5.0+, also only a subset of the UI classes respond to the UIAppearance protocol.
- supercoder 14y agoYeah, though targeting iOS 5 and up is really a non issue these days. UIAppearance actually supports any property on any UIView, including your own custom classes. The UI_APPEARANCE_SELECTOR declaration on the UIKit properties is little more than for the purpose of documentation to make it clear what is officially supported and tested for.
- shawn-butler 14y agoThanks for this info. So that means that UIAppearance is just some implementation hack on KVC? That is very useful and very ugly at the same time.
- shawn-butler 14y agoCould use categories rather than subclassing at first glance. Of course, usually my first glances are wrong.
- borgopants 14y agoA 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.
- schraeds 14y agoReminds me of Pixate (http://www.pixate.com/ http://www.pixate.com/), but open-source, no kickstarter campaign, and available today. Granted, the Pixate people seem like they will be offering a full compliment of tools to go along with the framework, but I am very excited about this project. Thanks for sharing.
- kreutz 14y agoRelevant: http://www.pixate.com/ http://www.pixate.com/
- bradfol 14y agoI 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.
- max81 14y agoNo surprise, any good/successful idea is always copied.
- pooriaazimi 14y agoI 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.
- deleted 14y ago[deleted]
- samnm 14y agoAs someone who backed them on kickstarter I probably have a biased perspective, but it seems to me that the product is coming along very nicely. They are quite open to with the development of Pixate to backers. There is also a Pixate demo app on the app store to see how it works on a device. Pity they haven't been so open with nonbackers.
- deleted 14y ago[deleted]
- josephlord 14y agoLooks 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.]
- bengl3rt 14y agoI'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.
- kyle_martin1 14y agoI 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.
- chrismetcalf 14y agoAnybody tried it with RubyMotion yet?
- pdenya 14y agoI'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"];
- adelevie 14y agoI'd love to try this out with RubyMotion.
- gry 14y agoTeacup is a RubyMotion-only stylesheet. https://github.com/rubymotion/teacup https://github.com/rubymotion/teacup
- adelevie 14y agoAre there any (dis)advantages between the two?
- DanielRibeiro 14y agoDon't forget Motion Layouts as well: http://malkomalko.github.com/motion-layouts/ http://malkomalko.github.com/motion-layouts/
- frankus 14y agoThe Three20 guys tried something similar a few years back: http://three20.info/extension/extCSSStyle 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.
- wlue 14y agoA 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).
- dia123 14y agoWow super cool - i wonder if it works with ruby motion? I don't know why it wouldn't.
- jquave 14y agoCoincidentally I submitted a HN article earlier that included this on a list of libraries. HN discussion url: http://news.ycombinator.com/item?id=4880974 http://news.ycombinator.com/item?id=4880974
- max81 14y agoHm, I see NUI uses method swizzling, which in fact a potential reason for app rejection.