How to update entire UI for the application according to user selection? - ios

I have an application requirement where user chooses color & font for title, labels, textfields. Images for logo, etc.
Here is the brief scenario:
Some screen which provides base application use
Settings screen, where user can update UI: Here I have provided textfields where user can enter color schemes for all provided labels and image selection.
For example, Line color, Line Shadow color, Font Color, Divider Color. User input will be R,G,B values (like, 123, 255, 89)
Once user save this configuration, entire application UI should be changed for all the viewControllers accordingly.
What would be the preferable way to achieve this?
I do already have all the IBoutlets for each and every label, textfields, imageviews. - Just FYI.
Thanks in advance for help.

The simple, non-complicated way of getting this working is to store all these choices in NSUserDefaults - and have all the customisable controls draw themselves using the property settings there.

Related

Button with icon on Apple Watch

I'm creating an App for Apple Watch which has a menu with two buttons like the Instagram App does. I'm wondering how you can put an Image file and text inside one button.
(It's not two separate objects as both image and text grey out when you click it.)
The only thing I can think of is that the icon and text were created as an image file and used as the background image of the button. Could there be another way?
Add a group element and in the Layout property choose Overlap
now all objects in the group are stacked

How do I re-use a color value throughout a storyboard

I am using storyboard to lay out my iOS app. I want to re-use some colors, and I don't want to re-enter the same hex string multiple times. What is the best way to do this?
You can drag the current color in the color picker (from the bottom left) to the list of swatches as in the screenshot:
You can also use the dropdown for picking a color to use a recent color. The list of recently used colors looks like it keeps 24 of them.

Adding Image And title both to UIsegmentControl IOS

Is there a way so that you can set both image and title of UISegmentControl simultaneously, so that image appear next to the title , just like image appear next to title in UIButton.
I am trying but if I set image of Selected segment of UISegmentControl then title disappears and if I set title of Selected segment of UISegmentControl then Image disappears, I want to set both at a time.
The official documentation for -setImage:forSegmentAtIndex: says
A segment can only have an image or a title; it can’t have both. There is no default image.
So, no, there is no way to do what you want using the image and title properties.
However, there are a few options to accomplish the objective in different ways.
if you are going to use the same image for each segment, you could use the appearance methods to set the background and then use the method -setContentOffset:forSegmentAtIndex: to move the title to the side of the background image.
you could create an image that had both the icon and the text in it. This is less than ideal as a change to the text requires exporting of the entire asset again. But is an option.
the least ideal would be to fake a segmented control using buttons that you write the code for to handle state changes. There may even be some open source options that do just that, so feel free to search for them.

Color slightly different when reapplying it programmatically [duplicate]

I have really weird problem with colors in interface builder. I set a color on one UI element, for example UIView, and then I want the same color on UIButton...but when I try to do so, colors are often different - I mean little bit different tone, not absolutely different color. How is this even possible ??? I've tried to use RGB sliders, and other sliders, also that color picker tool... Only thing that helps me sometimes is, when I create new UI element. Anybody had the same problem and knows what's going on ?
Interface Builder filters colors through your monitor's current color space by default. You can change this in Xcode4 IB by bringing up a Colors dialog, clicking the Sliders tab, then clicking the little dropdown button under the magnifying glass that looks like a color spectrum. This will bring up a list of available color spaces -- select Generic RGB and adjust the sliders as necessary to get the correct color.
See this question for more information, especially the comments on the accepted answer.
I solved this issue using "Device RGB" instead "Generic RGB".
See the image:
Unfortunately, fiddling with color spaces didn't work for me. What did work was editing the raw xml of the .xib (right click .xib, Open As > Source Code) and changing the RGB decimal values there.
The currently selected item in interface builder will be slightly different to its actual colour - it has a darkened mask applied to it to highlight the fact that it is selected. You need to click somewhere else in the window to unselect the item, it's real colour will then be shown. I've fallen into this trap myself.

What UI element might this be? (Custom tab-bar?)

http://www.flickr.com/photos/fraserspeirs/4329430635/in/set-72157623224262135/
The above is a link basically showing the form fill view of the numbers app on the iPad. Any idea as to how to achieve such a functionality which sort of looks like our vanilla tabs on Chrome?
You could do it with just buttons set to Custom type and using an image for the background. Then when they are clicked, bring the specific UIView to the front.
To create the tabs from a single image use UIImage's stretchableImageWithLeftCapWidth: topCapHeight:
http://tcninja.blogspot.com/2010/09/ios-adding-stretchable-uiimage-as.html
This will let you dynamically set the image's width in a way that will use the middle of it to fill the new area rather than stretching (and warping) the outer edges.
I would have implemented this with simple UIButtons. All you need to do is to style them (pngs or whatever), and track which one is the current.

Resources