HTML has CSS styles e.g. class="styleName"
Windows8/XAML has static style resources e.g. Style="{StaticResource styleName}"
Android has style tags e.g. style="#style/styleName"
iOS has ???
I'm using the interface builder for iOS in Xcode, how do I start to build up a style set or equivalent to styles? I want the ability to apply 'styles' to elements and then if I update that style's properties, the changes are applied to all elements that have been given that style. Is this possible in iOS development? Can someone please enlighten me as to how this is achieved or the equivalent please in iOS development. I'm very new to iOS development as you can see.
Is it more related to skins or themes? I don't have a clue.
There's Appearence. You often see this being used for colours, but it also does fonts, sizes, and a few other things. Here's another good article from a well known source.
Additionally, a common way to style/'skin' is by having different sets of background/button/... images.
You can also style by parameterizing drawing code. Have a look at the fabulous tool PaintCode.
Then, some companies do (part of the) UI in HTML/JavaScript.
Another thing to mention in this context is iOS' Auto Layout
You can do this with MarkupKit. See the section in the README entitled "Template Properties".
There isn't a good API in UIKit for this, unfortunately, but there are third party solutions with various tradeoffs.
I created a library that uses style classes, like CSS, which you can define in code, or inside a JSON file, and then apply to views in your app. As an extra benefit, the library uses #IBDesignable to live render your styles inside Storyboards without having to compile the app first to see the results.
https://github.com/daniel-hall/Stylish
Related
For Android I see there is a very good solution Json2View:
https://github.com/Avocarrot/json2view
for creating Android app UI on the fly. Is there any similar solution available for iOS? Is there any constraint is having JSON based UI concept for iOS, the way json2view does for Android? Or best would be some common open source library that has flavor for both Android and iOS.
Using React Native you can accomplish the same.
Strictly speaking, its not Json to View but its JavaScript to View.
Whatever views you create in ReactJS, will be created using native UIKit Framework.
For example, if you use scrollview component in JS, it will use a scrollview subclassed of UIScrollView.
Please check this link for in-depth overview
https://facebook.github.io/react-native/
https://github.com/facebook/react-native/issues/823
You cannot do anything like this, you will get apple rejected because of using any kind of code injection.
I have an app that has many components. In my case, there are several visual assets (a pie chart, a bar chart, a line chart, etc), and I'd like to be able to reuse those across multiple projects.
I have coded everything with a nice, top level delegate, which if implemented, the component can run on its own. (similar to UITableViewDelegate, or the like).
What's my best bet for separating the code out? It seems that the options are to create a Framework, or to use a subproject in XCode.
Frameworks look pretty robust, but seem complex to create. Also, with a framework, can you debug/step through code within the framework (assuming I have all the source, since I wrote it).
If anyone has done this for themselves, I'd be grateful for some insight.
I like to package reusable components into CocoaPods and either put them in a shared spec repo or reference them directly in the project's Podfile.
I was wondering if somebody could explain in the details how I can localize an iOS app using only 1 storyboard. I know how to localize by creating several storyboards(one storyboard for each used language), however I'd like to find out another solution.
Thanks.
The tutorial on raywenderlich.com uses two forms of localization together. The reason is he also checks the storyboard when turning on localisation in image 3:
.
So then what?
NSLocalizedString is very useful, any text set programatically can (and should) be localised using this method. Ray's tutorial is still very useful.
However, it's not very desirable to create a clone of the storyboard(s) to do translation, it's just not very maintainable in the long run.
And what about storyboards?
The magic happens using the Base Localization feature. Base localization uses the generated objectId's to 'map' different languages to the storyboard.
Do note that this feature is only available using SDK 6.0 and above. Running the app on a lower iOS version will not cause any errors, it'll simply won't work.
Go to your project, and select Base Localization, then add any other language.
Open your storyboard file and check the new language as well. Note the icon is not a storyboard icon, but a simple text file icon. That's a good thing; it won't copy the whole storyboard this time :).
Note how there is now another file 'under' the storyboard. Xcode automatically generates a file for every language you select.
You can se Localization feature for this. You need to add the Localizable.strings file for each supported language and use it for locaization.
You need to use : NSLocalizedString() for fetcing data corresponding to each key.
Check this tutorial for details.
I'm interested in such a thing - are there some tools, libraries, etc which will allow to design native iOS UI (UILabels margins, etc.) with the help of CSS? I am not talking about libraries such as PhoneGap or Appcelator. I'm interested in something like CSS parser which will allow me to transform CSS code into Objective-C UI code or Interface Builder.xib files. Let's say I have a good web-designer fluent in CSS and HTML and I want him to write UI code for my iOS application in CSS+HTML and then I transform it in Objective-C UI code or IB .xib files.
I think my question is clear and I hope for some good answers.
Services that allow you to design "native apps" or, more accurately, "hybrid apps" are actually bare bones app dominated by a web view or frame for a webpage so that you provide content and styling on a website that is being displayed by the app. It expands the capabilities of the "app" and allows you to put an app in the store but it is not on a par with true native apps.
There is no elegant conversion from HTML to Objective-C.
Seriously, if you want a native app, make an actual native app. Otherwise, just stick with a web app.
http://www.nativecss.com/docs/tutorials/intro/ios
for native ios development,it is very good tutorial for ios+CSS
Also check out: http://www.pixate.com/
It's not free but let's you do exactly what you're looking for.
The reason for PhoneGap, AppCelator etc. to exist is the reason that HTML+CSS (in other words "web pages") cannot be converted into Objective-C easily.
I suggest you take the straightforward way. Teach your designer to use the Interface Builder. It's just a WYSIWYG editor, nothing complicated even for a designer.
I see three20 a very powerful lib, spicily because Facebook and Twitter use it. I just want to know if there are any competitors/alternatives for Three20? or even simple.
nimbus seems to be a project that will address some of the issues.
I use Three20 a lot, but I'm always in search of an alternative, because Three20 is not a lightweight framework and because importing only a few features of Three20 is not practical. But I don't know any good alternative. If you only need a few features I prefer to write my own code for it or use another library.
For some features of Three20 I know other libraries that does the same thing. It's always a better way to use small libraries, because of file size and side-effects.
UILabel with styled text: OHAttributedLabel
Load and cache images asynchroniously: ImageLoader
Pull to refresh on a table view: PullToRefresh
In addition to this list you can have a look at TapkuLibrary which adds features like CoverFlow or a CalendarView to your app.
Finally GitHub is always a good resource, when you search libraries for special features.
Check this list of iOS controls.
You'll find over 200 open source custom controls there. I've used some of them (star rating, confirm button), it's lightweight and easy to embed. Check that the license suits your needs before though!
THree20 is one of the few libs but if you look around github you can find plenty of sample ios projects with source code to learn from and adapt to your app.
Three20 provides a lot of useful wrapper to facilitate development. It's biggest advantages and until know nothing could replace it.