How to make only the image itself clickable? - ios

I am currently making some sort of interactive map. It consists of images of 12 areas overlapping. The problem is that the image is squared, so if I click on a state next to it and it overlaps, I can't select it.
Is there a way to make only the image itself 'clickable' and not the transparent part of the image?

Related

Show part of image in a circular arc

I have an image which is like a progress bar in circle. I need to show only a part of the progress bar based on the progress percentage. What I am trying to do is to put the image inside an imageview and show only a part of the image (arc section of the entire circle) based on the progress.
I have tried using UIBezierpath to create an arc shaped view and setting my progress bar image as the background image. But the image will try to fit inside the arc shaped view and looks bad.
Is there a better way to achieve the same?
Edit: Here is a sample image of what I am trying to achieve
But instead of the blue background, I need an image. So, only part of the image will be visible depending on the progress. (When its 100%, the entire image is visible)
I have spend almost half a day on this one. Any help would be appreciated.

Set Clickable Area of an Image in Corona

I was trying to create a tic-tac-toe-like game but this time the board is a collection of hexagons in a rhombus shape. See image below:
Each hexagon is an image:
And each image has its own event listener. I am having problem with the clickable area, every time I click the lower two hexagons from the top. The top hexagon receives the tap event. I suspect that its because the PNG image has some portion occupying the lower two hexagons. Please give me recommendations.

ios frosted glass logic

Frosted Glass Effect
I'm thinking of how to approach this logically..
So we take the background image ( for example )
Then, we want to add our frosted glass button to this image. Here's how it should look..
Now I know I cannot programatically blur the background image of the button, so I'll to try and do it with two images.. Background.png and Backgorund_Blurred.png.
Now, the frosted glass effect will happen on animated objects. So, as they move across the screen, it should appear that it is blurring the background image behind it, however, to achieve this I can only think of one way. But doing so is beyond my current capability.
It would have to be a background_blurred image for the UIButton for example. No scaled in any way, and the exact same size as the normal background. Then, I would have to take the buttons relative position on the normal background and append the background_blurred of the button to suit.
My first question; is this possible?
Second question; is there an easier approach?
Lastly, I've added an image to make sense of the relative position theory.
Check out the FXBlur library, it'll let you blur images/views.. I've used it successfully and sounds like it'll do what you want.
I think having two images for these assets maybe easier, but having the views blur may be better in the long run as you wouldn't have to worry about updating the images for different resolutions in the future or care about how big the button is/will be.. Also if you want to do this with more images it'll turn into a mess with all the different images to manage.. The library is simple to use, with one call you'll have a blurred image/view..

Fill image with different color by detecting the different parts

I have an Image of a landscape which i need to fill with different colors.
When i select colors from palette and start scrubbing on any particular part, only that part should get the color even if by mistake i take my finger outside of that image part.
So basically i need to detect which part of image have i tapped so that only that part takes the color.
I am developing this app in Cocos2dx, but any help in logic would be a good point to start.
Here is an example of what i want.
Note : I know i could achieve this by taking separate images and then detecting touches, but that increases the app size by alot of MB's.
I guess user will be able to draw only on white part of the image.
If above is true, what i want you to do is, in your touchesMoved method, check if any black color (non white) pixel is present between previous touch point and current touch point.
If there is no such black pixel, then draw it else dont draw it.

How to dim/blur everything outside given rect in iOS?

I'm currently developing an iOS app that is using OCR.
Currently I'm using AVFoundation to preview the video from the camera (using Apples sample AVCam).
For a good user experience I want to lay out a rectangle in the preview layer. The image inside this rectangle will be the image parsed by the OCR engine. My problem is that I also would like to "dim" everything outside this rectangle and I'm currently out of ideas how to solve this. Does anybody know how to do this?
Edit
This is what I would like to accomplish (image taken from the app Horizon):
http://i.imgur.com/MuuJNS9.png
You can use two black images covering the top and bottom areas that you want to "dim", set the alpha of those images to a certain value, like 0.5.
Why not add a subview that covers the entire screen and set the background color to a semi transparent gray - your gray overlay?
And then add the image parsed by the OCR engine add a subview of this grayoverlay int the center of it

Resources