how to display color palette in iPhone - iphone

In my iPhone app, I want to allow the user to draw image by hand with different colors.
I want the color palette where user can select the color and draw with the selected color.
How can I show the color palette in iPhone?

You can create a view with several buttons on it. Buttons should have background color also give them different tags (according to color). Now when you press on the button get its tag and then you can get the color from an array (you need to first create an array with color codes or RGB). when you can color code or RGB you can draw with that color.
Post comment if you have confusion

You'll have to do this yourself as there is no system color picker. If you don't want to create one from scratch, you might want to look for some existing free project as a code base.
Take a look at this open source project, for a start. It's under the BSD license.

Related

Change color of whole app - for every item outlet necessary?

I have a color set in the assets catalog and I used this color now for all my buttons, labels, switches, image backgrounds and so on.
I want to create now the ability for the user, to select it's own color (by using a color picker) for the whole app.
As far as I have googled now, I understand that it is not simply possible to change the assets color, I have to create a color and store this in the UserDefaults and load this color every time the viewDidLoad.
The question is now, because I am using storyboard to create all my buttons, switches and so on, do I have to create for every single item an outlet to change the color?
Or is there a better approach to handle this?

How can I create a Apple Watch complication that has multi colors?

My objective is to create an Apple Watch complication that has multiple colors. Specifically, I want the multi-colored template image that I submit to stay multi-colored instead of defaulting to white. This is on a multi-colored watch face, I know the color will be overridden if the user selects a color tint for their watch face.
What code would I put into which files to keep my complication template multi-colored?
UIImage has a parameter to define how it is rendered on screen when placed inside of an UIImageView.
If you're loading this image in your code you'll need to set UIImage.RenderingMode to .alwaysOriginal in order to have the system display its colors when there's no tint override. However, if you're simply loading from an Xcode Asset Catalog, just select the asset and then change the rendering mode from the menu in the Inspector.
Select the Inspector, then select Original Image from the Render As dropdown.
See the developer documentation on rendering mode.

Changing the particular color in an image

By using the following image i want to write code.
here is the image i want to do this one programmatically.
User can select roof or wall or fencing or windows. After selecting the particular part and color(another model) then the present color(another model) should replace with selected color.
In this image(example) user selected color(yellow) for wall and brown color for roof, after selection of color and part, old color should replace with new one.
How can we achieve this
any suggestions or help
Check my answer of how you can change the specific colors of UIImage.
Two notes:
the question is about gray to white color change, you can use this technique to change any color to any other,
the code is taken from somewhere of the developers reference, so that colors in the snippet are kinda random.

How to know the background color of Pdf

Sometimes pdf might have a transparent background. And In my application I have given a option to choose background. So, in case of pdf with transparent background and background color black all things becomes black black so, any way to check or any key inside dictionary of pdf page that can help me? Any help will appreciated.
The easiest solution for you would be to remove black color from available background colors.
Generally, all pdf pages have transparent background and the white background color is set by the viewer application. It is possible to set a background color for each page. You can read all about it in Page Group under Transparency section of the PDF Reference.
It is also possible to show a background color for a page by setting 'BoxColorInfo' dictionary in the page dictionary with appropriate values.
But I am not sure what you can achieve by knowing what color a page background is, since black background is going to be a problem for PDFs with transparent pages anyways.
EDIT: Following is the paragraph from PDFReference i was trying to point you to:
Ordinarily, the page is imposed directly on an output medium, such as
paper or a display screen. The page group is treated as an isolated
group, whose results are then composited with a backdrop color
appropriate for the medium. The backdrop is nominally white, although
varying according to the actual properties of the medium. However,
some applications may choose to provide a different backdrop, such as
a checkerboard or grid to aid in visualizing the effects of
transparency in the artwork.
It says that most PDFs would have a transparent and it is your application which shows the background color. Hope this helps.

how to draw a popover view instead of using image on iPhone?

just like the popover in the attached screenshots, the popover allow user to change themes.
I know that there are some examples around but they are all using images to achieve this, make it hard to change themes.
I believe the app in the screenshots doesn't using images to do it.
thanks for any help!
In my Win background such skins (called "Flat" in Delphi and WinForms) were made by drawing in code: select a color, draw a line, select another color, draw a rounded rectangle and so on.
Also, it is necessary to introduce a class "ColorTheme" with a set of fields for every color used. You may have several ColorTheme instances and swap them when you need to change color theme.