MDCFocusView
Apply a "tutorial screen" overlay to your application window.
MDCFocusView
can apply a focus on an arbitrary number of views,
and prevents users from tapping views not currently focused on.
Check out a demo on Vimeo.
How to Use
You can install the project using Cocoapods, by placing pod MDCFocusView
in your Podfile
. After installing:
// Initialize MDCFocusView and customize its background color
MDCFocusView *focusView = [MDCFocusView new];
focusView.backgroundColor = [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.8f];
// Register a MDCFocalPointView subclass to "wrap" focal points
focusView.focalPointViewClass = [MDCSpotlightView class];
// Add any number of custom views to MDCFocusView
[focusView addSubview:[self buildLabel]];
// Present the focus view
[self.focusView focus:someView, anotherView, nil];
Please see the sample app for an example.
Features
- Because
MDCFocusView
usesMDCFocalPointView
to wrap focal points, it is highly extensible--to create your own focus effect, simply subclassMDCFocalPointView
and implement any custom drawing behavior indrawRect:
. Please seeMDCSpotlightView
for an example.
Limitations (or Ways to Contribute to this Project)
- Currently
MDCFocusView
can only be applied to the entire application window. Ideally, any arbirary view should be able to addMDCFocusView
as a subview. - Currently only
MDCFocalPointView
andMDCSpotlightView
are available, although I would like to make more. It would be nice, for example, if a Gaussian blur could be applied everywhere but the focal points. - See the GitHub issues for more bugs/feature requests you can help with.