tags:

views:

25

answers:

1

Hello,

Being a complete noob in iPhone development, I was wondering what would be the best way to define regions in an Image (for interaction ). So far I've got 2 ideas :

  • use CGpath to basically draw the areas that I`m interested in but I quickly can see it becoming tedious on complex graphics .

  • use a Color coded layer with regions containing different RGB values and return those as my regions .

Are those sensible approaches ?

A: 

Depends on what you mean by interaction and whether you want the regions to be visible to the user. A simple approach would be to just add UIButton's above your image. They can be transparent and any size (rectangular) that you like. Or they can contain images or colors to be visible to the user.

If you need arbitrary shapes then this solution won't be useful to you.

joelm
thanks for your answer, I`ve tried with UIButtons, but as you say, I hidden arbitrary shapes. So I was thinking about hiding a color coded image of which I could query the RGB values to define the regions, unfortunately I need a bit of guidance to implement that :)
Julz