Question

In the Accessibility options of the iPad Settings app, there is a Guided Access option (available in iOS6) that keeps the iPad in a single app and allows you to control which features are available. Tripping-clicking the Home button triggers Guided Access where you then have the ability to circle areas on the screen that you would like to disable. My question is how is the circling of the regions implemented? I am very curious as to how they form a closed, reasonable region based on any user input.

Was it helpful?

Solution

If I'm right you are drawing rectangles. If you are able to draw circles to : approximate the circle with several rectangles. (You can do this easily with the UITouch methods. For a rect measure the startPoint. This is the x and y of the rect. Then measure endpoint. endPoint.x-startPoint.x = width of rect. The height is the same with y values)

Eaches of these rectangles sets the frame/bounds for an UIView *theView

This view should be transparent: [theView setBackgroundColor:[UIColor clearColor]]

To prevent the touche/user interactions "going trough" the view enable it to user interaction: [theView setUserInteractionEnabled:YES]

Add those views to the superview - make sure that those views lays over every other layer of the superview. Now you can't interact with anything laying under those views and you have a similar behavior to the guided access.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top