how to draw a popover view instead of using image on iPhone? - 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.

Related

Create adjusted image similar to UIButton's adjustsImageWhenHighlighted effect

I'm working with some data icons in table view. And sometimes my icons is in disabled state. I want to try create grayed versions of my icons programmatically, before I ask designer to do that for me.
Similar adjustment happens in UIButton when image auto-adjusted for highlighted state. Does anyone know how to do that image adjustment?
What about just modifying the alpha of the icons?
If you make the images partly transparent you'll get a similar effect and no extra programming is needed.
Another possibility is to add a partially transparent gray UIImageView over the button. The button will essentially be made gray-looking -- you'll need the UIImageView to have an alpha of about .2, or somewhere in that range.

iOS - UILabel editing, overlaying an image?

As you can probably tell from my last few questions, I am working on a screen that allows users to edit labels. Pages and all the other lovely apps have glorious resizing handles to show what label is currently being edited.
I am trying to get some feedback on the best way to do this. Is it possible to add an 'dot' image to the centre of all the edges of the label? Is it possible to change the background colour only in sections of a label?
Or should I add an image on top of the label and disable it? The most important feature is for only the uilabel to respond to touches. If I overlay an image, I want it to ignore the touch and hand it off to the label.
Any feedback appreciated!
Cheers Guys!
You will find as many opinions on this as there are programmers. There is not built-in decoration for a view that shows the dot in the middle of each side. But you can add that easily enough. One way is instantiate four instances of an image with the dot and add them as subviews of the view you are decorating. you can then set the center of each dot on the center of each edge in the parent view. As long as clipping is turned off in the parent view, these will show up (if they are not hidden) even if they extend outside the frame of the parent view.
I don't understand what you want to accomplish by changing the background color in sections of the label view, but I this probably has some moderate complexity to it.
You can also to this with core graphics. I'll stop there, though. There are literally many ways to do what you are trying to do.

how to display color palette in 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.

UI Button with Image Smaller than Touchable Area

I've not much response so am adding some more info.
My buttons are not rectangular, nor organised in a grid so I need a way of creating what looks like a button (and shows that it has been pressed visually, as per a standard UIButton) but where the touchable area is different to the image area.
I am using a transparent PNG and that element works fine. I've added the buttons in Interface Builder and am wondering if that is the problem.
However, if I change imageEdgeInsets, it distorts the image display, which is obviously not what I want.
Bizarrely, if I increase the dimemsions of the button, it doesn't change the image, but if I decrease them it does.
I have tried different combinations of mode (scale to fill etc), but to no avail.
I am aware that there is an image and background image property, but in IB there is only one.
Essentially, I don't understand how the geometry works and the Apple documentation doesn't seem to help.
Surely, I can't be the only person to try to do this. Any help would be warmly welcomed.
Many thanks,
Chris.
Try setting the buttons setting to Aspect Fit. This will fill the button with your image so a smaller image than the button size would leave the space around the image.
Also set the button type to custom.
In the end, I stumbled across Ole Begemann's Non-rectangular buttons class. It just does what I need - to be able to create buttons where the touchable area follows the visible element of a non rectangular image.
#Helium3 - thanks - that allowed me to use a larger touch area, bit not a smaller one.

Modifying, coloring and dragging pre-existing images iPhone application

I am developing an iphone application which would let me modify the image by dragging other images over its top along with functionality that would let me choose a specific color from the image and replace it with some other color shades i choose. If anyone has some clue like how to actually implement it or some code, that would be great help for me to proceed in right direction
Thanks in advance :)
If you just want to overlay images, you can simply drag UIImageViews around and position them within the view hierarchy such that the appropriate images are overlaid one on top of the other.
For generating a new image out of those composited images, you may want to use something like CGContextDrawImage() within a UIView subclass's -drawRect: method or in a custom CGContext. You can also refer to these similar questions:
How can we combine images and get image object from this two images in iphone apps
Combining images
As far as selectively replacing a specific color within a UIImage, that's a commonly asked question here:
In a UIImage (or its derivatives), how can I replace one color with another?
How to make one color transparent on a UIImage?