Spark AR multiple UI pickers? - augmented-reality

I am trying to figure out a way to add multiple UI pickers on Spark AR.
For example, let's say I am making a beautify filter and I would want to let the user change the brow colour, lip colour and blush colours seperately. (but shown at the same time)
I think I might have to use multiple UI pickers for that? a picker for changing the lip colour, a picker for changing the brow colour, a picker for changing the blush colour. BUt I am not sure if that's possible.
What I thought I could also do is to use the UI picker to let the user choose the eyebrow/lip/blush and then use the tap to change function to change the colours? I am not sure if that makes sense.

Related

Change colorPrimary and colorAccent programmatically for use in ContextThemeWrapper

I'm working on a live event app for a client. There are about 20 view containers that make heavy use of colorPrimary and colorAccent for coloring the views.
The client has just now decided that those colors should be different for each event.
Is there any way for me to use ContextThemeWrapper to simply inject the colorAccent and colorPrimary received from the backend? That way, when I start EventActivity, I can just put in the correct colors, and those would propagate all the way down to the activity's View, Fragment, and Dialog children.
If that's not possible, I guess I will have to go through each View one by one in Java and set the appropriate colors. That's tedious but easy. What's not easy are my shapes defined in XML. For instance, I have a drawable that I use as a button background which is simply a 1dp stroke on a rectangle with rounded corners. The color of the stroke is colorAccent. How would I go about changing that at runtime?

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