Skip to content

Latest commit

 

History

History
135 lines (98 loc) · 4.83 KB

README.md

File metadata and controls

135 lines (98 loc) · 4.83 KB

MDBlurView Demo

Screenshot

Important!

As of recently, Apple has been rejecting apps that use MDBlurView. To work around this, place the following set of defines at the bottom of your *Project*-Prefix.pch file, so that MDBlurView can no longer be found via static analysis:

#ifndef DEBUG

#define MDBlurView CheeseSandwichView
#define MDBlurLuminosity CheeseSandwichLuminosity
#define MDBlurLuminosityAutomatic CheeseSandwichLuminosityAutomatic
#define MDBlurLuminosityBright CheeseSandwichLuminosityBright
#define MDBlurLuminosityDark CheeseSandwichLuminosityDark

#define blurFraction cheeseSandwichFraction
#define blurRadius cheeseSandwichRadius
#define blurLuminosity cheeseSandwichLuminosity
#define _blurFraction _cheeseSandwichFraction
#define _blurRadius _cheeseSandwichRadius
#define _blurLuminosity _cheeseSandwichLuminosity
#define setBlurFraction setCheeseSandwichFraction
#define setBlurRadius setCheeseSandwichRadius
#define setBlurLuminosity setCheeseSandwichLuminosity

#endif

Do not forget to rename the occurances of cheeseSandwich in the above sample code to a new string of your choosing, otherwise Apple will end up blocking CheeseSandwichViews as well 😉.

Note that you can continue referencing MDBlurView in your code — the only difference will be that when it is compiled, it'll be replaced which whatever you renamed it with in the above defines.

Purpose

MDBlurView is a multiuse background view you can use for bluring in your iOS 7 Apps. In addition, it provides some customizable properties that all adhere to UIAppearance, including some novel ones such as masking. Please visit the MDBlurView repository for the actual code :)

If you use MDBlurView in your app, please add it to the list!

Installation

$ git clone https://github.com/mochidev/MDBlurViewDemo --recursive

To include it into your own projects either download the source, or run the following on your git repo:

$ cd <your_repo>
$ git submodule add [email protected]:mochidev/MDBlurView.git <local_subpath>/MDBlurView

This will allow you to update it at anytime by running $ git submodule update.

Usage

Simply add the MDBlurView submodule to your project, and add an MDBlurView to your view, either in Interface Builder, or in code:

MDBlurView *blurView = [[MDBlurView alloc] initWithRect:CGRectMake(0, 0, 100, 100)];

Notes

In the background, [MDBlurView](https://github.com/mochidev/MDBlurView) uses _UIBackdropView to generate the blur, generated by using a UINavigationBar, and gutting its internals. For this reason, Blurs are not available pre-iOS 7 (because the lack of UIBackdropViews), nor are they available on devices where Blur is disabled (like the iPhone 4).

Internally, it seems that _UIBackdropView uses three CAFilters on its layer to acheive the effect.

Customization

To Do

Coding Style Guidelines

Please see https://mochidev.com/codestyle

License

Copyright (c) 2013 Dimitri Bouniol, Mochi Development, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software, associated artwork, and documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

  1. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
  2. Neither the name of Mochi Development, Inc. nor the names of its contributors or products may be used to endorse or promote products derived from this software without specific prior written permission.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Mochi Dev, and the Mochi Development logo are copyright Mochi Development, Inc.

Credits