With the seventh version of iOS, many UI elements have become more attractive (see
Session 226, Implementing Engaging UI on iOS ).
For example, now pop-overs, most bars and alerts have a blurred background.

')
What to do if you want to add blur to your control, this article will prompt.
Blur is different
There are two types of blura: static and dynamic. As the name implies, the first one blurs the content once, and the second one is updated at short intervals.
It is easy to implement blue. The general scheme is to take a snapshot of the background behind the view (for example, using
renderInContext ), blur it and set the resulting image as the background view. In the case of a dynamic blur, all of the above actions are performed on a timer. As an example of this approach, I recommend
looking at FXBlurView .
The main advantage of the 7-ki in terms of the bluer is high speed. For example, you can watch the video and at the same time the panel with volume control will be lit in real time without any lags.
So, ways to implement quick blur in iOS 7.
Leier theft
The idea is quite simple. Since the UIToolbar has transparency, you can take and use its leer as a background.
UIToolbar *toolbar = [[UIToolbar alloc] initWithFrame:[self bounds]]]; [toolbar setBarTintColor:[UIColor greenColor]]; [self.layer insertSublayer:[self.toolbar layer] atIndex:0];
The approach is good, stable and very simple.
There is already a ready implementation called
iOS-blur (available through CocoaPods).
Using drawViewHierarchyInRect: afterScreenUpdates
If the task is to tricky cunning blur, you will have to take the background yourself and blur it.
Fortunately, iOS 7 has an extremely fast way to create snapshots view
drawViewHierarchyInRect: afterScreenUpdates .

In the picture from the presentation, it is clear that the speed of obtaining a snapshot view has increased 15 times!
It is quite simple to use (
ready implementation ):
-(UIImage *)blurredSnapshot { UIGraphicsBeginImageContextWithOptions(self.bounds.size, NO, self.window.screen.scale); [self drawViewHierarchyInRect:self.frame afterScreenUpdates:NO]; UIImage *snapshotImage = UIGraphicsGetImageFromCurrentImageContext(); UIImage *blurredSnapshotImage = [snapshotImage applyLightEffect]; UIGraphicsEndImageContext(); return blurredSnapshotImage; }
In this example, the
UIImage + ImageEffects category taken from WWDC and using the power of the
Accelerate Framework is used for blurring. Of course, you can blur and something else. For example
CIFilter or its private implementation as done in
JMIBlurView . The main idea is that with 7-s you can persist to use
renderInContext , which
takes almost a second and achieve real-time blur without using shaders.
As an example of implementing a dynamic blur, I recommend
looking at 7blur .
Conclusion
Blues on iOS7 is very fast and easy to implement. So feel free to use it in your applications, without fear of losing performance.