Overlay MapView with hole - ios

I would to add an overlay on mapView with a hole.
So, I would add a black transparent overlay on my map and on a specific position I would to have this hole through which I can see the map without black overlay.
In this hole I have to show my results. Is possible this?

(1)If the overlay could be a simple imageview. Just prepare a png file with full transparent hole and black transparent background.
(2)If you need a dynamic view which might be different at run time, I think the best approach is to prepare a similar image from (1), then apply it as layer mask.
Here is a tuto:https://www.youtube.com/watch?v=H6V_PbCKEO8

Related

Cocos2d iOS: How to draw shadows underneath a CCNode

I'm building a simple card game and would like to draw shadows when users pick the cards up. Any quick solutions?
Example:
Quick solution? Draw a black shape (or whatever the shadow color is) on a layer behind your selected card. Just like in your example image you have a fuzzy gray square box behind, but yet slightly down and to the right, of another square that is on a layer on top of it. Or you can draw the shape underneath the card and move the card a little to give the illusion of it rising.

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

Removing specific area from blurred space MKMapView

Is there any chance to remove blur on a specified area to achieve something like below? Assume that I have blurred MKMapView and want to remove circle shaped blurred area from MKMapView. Any other opinions to achieve something like this would be appreciated.

Apply a CIFilter to a UIView & all subviews

I have a UIView, that contains a UIImageView for its background. The view contains a number of segments (UIImageViews), which the user can drag and drop images to. I want to add a CIFilter to the whole view, such that any images that are subsequently dropped into the view will have the filter applied instantly. But the filter shouldn't be applied to the main view's background image. I realise that a CIFilter requires an input image, I was thinking of using a transparent input image, then placing the filter on top of all the views so it would only be visible when there is an image behind it.
Is it possible to supply a transparent input image to a CIFilter?
Is this the best way of going about it?
I suppose I'd need to mask the filter to the view containing the segments so that it is not applied to the background image. How would I go about this? Since a mask needs an image to mask to, I guess I'd need to render the segments view to an image and mask to this?
Thanks in advance

Colorable pin view

Does anyone know of any code to draw the pins we see in MKPinAnnotationView in a regular UIView?
The motivation is to remove the hundreds of different colored pin images we are currently bundling with our app to drop all over medical images (regular UIView backed - not MKMapView). All I really need is to alter the pin color programmatically .
NB: I am not talking about the callout as seen in SMCalloutView etc .
This is to be used outside MKMapView. They are dropped into a normal UIView.
Here are two approaches to consider:
Ship a single pin image - say, red. Use the Core Image CIHueAdjust filter to change it to other colors.
Ship a pin image with a white bulb, and an alpha-channel-only mask image that selects the pixels in the bulb. Use Core Graphics to create new pin images dynamically at runtime. You'll want to draw the white bulb pin into a bitmap context. Then use the mask image to set the context's clipping mask. Finally, fill the context with whatever color you want the bulb to be.

Resources