Change color-theme in whole iOS application - ios

I am going to implement Alert feature in my application.
When user taps an alert button my application is about to change all orange (default) colors to red (Navigation bar, switches, Tab bar, Buttons, views and other stuff).
I want to implement it using "css" files also known as stylesheets.
I've found two libraries: Motif and NUI.
The most important problem is to dynamically change theme inside application. Motif can do this but I want to do it more simple.
Also I learned that NUI can change the app theme too but I can't to change it dynamically.
P.S. I am using storyboard and XIB-files. I need to add runtime attribute for object's key-path. This attribute will go to my stylesheet file and apply styles. It's the most simple way I think.
Can I do it simply and without any libraries?
P.S.S. NUI is more simple for me. Maybe you know how to change styles when application runs.

There are ways of making this work, but not very simply. So your options are either to construct your own solution, or use a library.
If you are looking for something that feels easier and more native than NUI or Motif, and which also lets you assign styles and see them rendered live inside your storyboards, take a look at my library for this: https://github.com/daniel-hall/Stylish
Here is a demonstration of changing the "stylesheet" (which can be created either in code, or in an external JSON file) at runtime:

Related

How to override values/file in framework in ios

I have developed the application in ios. It is working fine. I have converted it as a framework(library) so that My codebase remain same.
I have multiple clients for this app. So I need to change the following things
Colors (As it will change the background colors, text colors etc)
Strings (Like headings and labels in some views)
Some files like Images etc
What I want:
As I am android developer, So in that I can create another color file in my client app with same color name, that replaces the color value in Library. and this it just require only one file to be replace and it automatically overrides in library. Same was the case with the String.xml and image files
Looking for something like that as I have described above.
What I searched and found so far:
After searching alot I have found that I need to make outlets public and then I can give them color by accessing them. But What If I have a 1000 of views and 1000s of outlets to make to use this technique, Isnt it better to use it as same way as in android I described above.
Confusions:
Is there anyway in IOS to declare color in a file and to use them in IB and code as well. Well I read about Color.xcassets but that is for ios 11 I think
How to make strings file and to use them in IB and in code. Like strings.xml file in android?
So I short, I want to updated colors,Strings and file per client wise and I do not know how to do it and what is a best way of doing this??
Please help and thanks in advance. Please share your views.
You should configure your framework to read from predefined files in .plist file. this will require only changing the files content in the client application.
Easy way to handle colors and theme using SkinKit. This is too old code. You just reuse idea or create custom themes configuration file(plist,JSON),Strings and images as .bundle read all color and customization from that bundle. So easy to change Colors, Strings and Images assert for various clients.
You seem to have a misconception about what IB is — in particular, what a nib is, and what it means to edit a nib, which is what Interface Builder does. A nib is a file expressing potential instances, typically views. You edit it on your computer using Xcode (IB). When your app runs, the nib is loaded and the views are actually instantiated. That is the only thing you can do with a nib when the app runs. You cannot modify the nib in some way when the app runs; all you can do is load the nib and get the instances.
So, if you want to change all the titles of buttons or all the colors of views when your app runs in accordance with some configuration file, you can do that, but that has nothing to do with nibs or IB. You would just load the nib as usual to get the views, and then change them all, one by one, in code. You could use tags or some other identification mechanism to help you find each view, but that would be entirely up to you to work out.

Are there any convenient ways for managing color schemes in an iOS app?

I was wondering if there are any standard or convenient ways for managing color schemes with storyboards in an iOS app, instead of having to manually change the colors of many different UI objects.
Thanks!
There is a tintColor that a few interface elements will pick up by default. You can configure the storyboard (right side menu) on the Global Tint setting.
If you want more costumization, there is a cool recent feature called UIAppearance. It lets you costumize interface elements by code, and that is applied in all such elements across the app.
Here is more info:
http://nshipster.com/uiappearance/
This is a fine question. We once had to do a complete color palette adjustment in a very large (> 100 view controller) app, and it was a suboptimal experience. For colors that are defined in code, the changes were easy enough. For colors specified in xibs or storyboards, though, it sucked. Because IB stores colors as raw double RGB values, there's no easy way to grep through the xib and storyboard xml files to do a simple search and replace. I wound up having to write a Ruby script that would find RGB values in the XML files, convert the doubles to integers in the (0..255) range, and then prompt the user to enter new values. The script cached the user's answers so that the user wasn't prompted multiple times for the same color values.
In hindsight, I still would prefer to specify colors in the storyboards & xibs so that it's as WYSIWYG as possible, and instead insist that the designers can make the changes themselves if they ever decide to modify the palette. :)

Is there anything like AXML for iOS?

In Android, you lay out a view with an AXML file, where you specify the hierarchy of sub views and their relationships, and the OS loads this file and renders the view.
In iOS, there's a NIB file, which is similar in concept, but it's completely human unreadable (in my opinion). You can create this file with the WYSIWYG editor in Xcode, but you can't just type it by hand, because it's immensely complex and impossible to get right.
I find the WYSIWYG editor unwieldy for any but the most trivial layout, and so I'm also finding that in iOS, it's easier to build the control tree in code than to use the NIB file. But the AXML approach seems much easier still.
So, I'm wondering if there's any iOS library that would let me lay out the code in a declarative way (that is, not with a designer), and then create a view from that, with automatic resizing and other conveniences.
The .storyboard format is a simpler format to read, use that instead of XIB files.
It seem like you are coming in iOS development from Android.
But Editing background XML (Back Source) view file is not style of iOS.
Yes you can see that file but Apple want that you design your app by using this two approach only.
How I can say that? Because apple have not provided any document for how to do that (At least I have not come across any).
Design in visual editor (XIB Or Storyboard)
By Using code (Create view and controls and addSubview)
Mostly we use mix approach we use top level and simple design by first one and use detail and complex design by second one.
Storyboard is new and very good one try to use that.

Tab Bar like WhatsApp

How do I create a tab bar like WhatsApp on BlackBerry in my BlackBerry app? I want that feature in BlackBerry OS 7.0. I have used managers -- HorizontalFieldManager and VerticalFieldManager -- to achieve it. But it doesn't look as attractive as WhatsApp. Can FieldTabController help me do this?
It's not going to look attractive if you are just making tweaks to the code, and then seeing what that looks like. You need to start with a design you find attractive. Once you have that goal put together as an image, you start writing code to make the UI look like the design image.
The WhatsApp tab bar is not a straightforward combination of built-in UI managers from RIM. It has a fair amount of customization - each tab has three visual states, and there is a tooltip that follows the focus, as well as a context tab on the right that changes depending on the currently selected main tab. This means there are several interacting UI components here, not just a single magic manager.
Essentially, you will probably want to start building your own custom Field objects.
Basically, subclass the Field class (or one of the other subclasses), and learn to love the paint(..) method and the Graphics API.

iOS - Display grid of icons to select

I'm looking to create a grid of icons from which one can be selected (see the Daytum app for an example of this).
Are there any existing form entry frameworks for iOS that already support this (eg QuickDialog is excellent, but doesn't support this)
What would be the best way to implement this? Assuming selecting an icon brings the user back to a form field with the icon populated in the field.
Are there any other apps apart from Daytum that use this 'model?
Three20 has a grid view controller, that makes it pretty easy to add icons in a grid.
I'm a huge fan of AQGridView. Used it in a couple of projects and i think its really really built well and easy to implement.

Resources