I would to do a Quizz like the image, when clicking a country it shows the correct answer
My question : Can i Do like this :
- Each country is an UIImageView or
- Each Country is a custom UIButton.
Witch are the Best solution ? Any Helps Please
I would to do a Quizz like the image, when clicking a country it shows the correct answer
My question : Can i Do like this :
Witch are the Best solution ? Any Helps Please
You can use UIButton
s for that. In both cases you will have to solve the issue of your buttons or views being irregularly shaped.
On github you can find a project by Ole Begemann which extends UIButton
so that it only detects touches where the button's image is not transparent.
Since the countries are not even close to being rectangular, I'm afraid you'd have to come up with a much more sophisticated way to detect the touches. Neither a UIImageView
nor a UIButton
will serve your needs.
One approach to tackle a task like this might be to assign a unique color to every country and then obtain the pixel color of the touch's location. You'd have to create some kind of mapping between the colors and the countries to determine which country was touched.
See How to get pixel data from a UIImage (Cocoa Touch) or CGImage (Core Graphics)? to get an idea of how to obtain the color of the touched pixel.