Giter Site home page Giter Site logo

fxblurview's Introduction


WARNING: THIS PROJECT IS DEPRECATED

It will not receive any future updates or bug fixes. If you are using it, please migrate to another solution.


Purpose

FXBlurView is a UIView subclass that replicates the iOS 7 realtime background blur effect, but works on iOS 5 and above. It is designed to be as fast and as simple to use as possible. FXBlurView offers two modes of operation: static, where the view is rendered only once when it is added to a superview (though it can be updated by calling setNeedsDisplay or updateAsynchronously:completion:) or dynamic, where it will automatically redraw itself on a background thread as often as possible.

Supported iOS & SDK Versions

  • Supported build target - iOS 8.4 (Xcode 6.4, Apple LLVM compiler 6.1)
  • Earliest supported deployment target - iOS 7.0
  • Earliest compatible deployment target - iOS 4.3

NOTE: 'Supported' means that the library has been tested with this version. 'Compatible' means that the library should work on this iOS version (i.e. it doesn't rely on any unavailable SDK features) but is no longer being tested for compatibility and may require tweaking or bug fixes to run correctly.

ARC Compatibility

As of version 1.3, FXBlurView requires ARC. If you wish to use FXBlurView in a non-ARC project, just add the -fobjc-arc compiler flag to the FXBlurView.m class. To do this, go to the Build Phases tab in your target settings, open the Compile Sources group, double-click FXBlurView.m in the list and type -fobjc-arc into the popover.

If you wish to convert your whole project to ARC, comment out the #error line in FXBlurView.m, then run the Edit > Refactor > Convert to Objective-C ARC... tool in Xcode and make sure all files that you wish to use ARC for (including FXBlurView.m) are checked.

Installation

To use FXBlurView, just drag the class files into your project and add the Accelerate framework. You can create FXBlurView instances programatically, or create them in Interface Builder by dragging an ordinary UIView into your view and setting its class to FXBlurView.

If you are using Interface Builder, to set the custom properties of FXBlurView (ones that are not supported by regular UIViews) either create an IBOutlet for your view and set the properties in code, or use the User Defined Runtime Attributes feature in Interface Builder (introduced in Xcode 4.2 for iOS 5+).

UIImage extensions

FXBlurView extends UIImage with the following method:

- (UIImage *)blurredImageWithRadius:(CGFloat)radius
                         iterations:(NSUInteger)iterations
                          tintColor:(UIColor *)tintColor;

This method applies a blur effect and returns the resultant blurred image without modifying the original. The radius property controls the extent of the blur effect. The iterations property controls the number of iterations. More iterations means higher quality. The tintColor is an optional color that will be blended with the resultant image. Note that the alpha component of the tintColor is ignored.

FXBlurView methods

+ (void)setBlurEnabled:(BOOL)blurEnabled;

This method can be used to globally enable/disable the blur effect on all FXBlurView instances. This is useful for testing, or if you wish to disable blurring on iPhone 4 and below (for consistency with iOS7 blur view behavior). By default blurring is enabled.

+ (void)setUpdatesEnabled;
+ (void)setUpdatesDisabled;

These methods can be used to enable and disable updates for all dynamic FXBlurView instances with a single command. Useful for disabling updates immediately before performing an animation so that the FXBlurView updates don't cause the animation to stutter. Calls can be nested, but ensure that the enabled/disabled calls are balanced, or the updates will be left permanently enabled or disabled.

- (void)updateAsynchronously:(BOOL)async completion:(void (^)())completion;

This method can be used to trigger an update of the blur effect (useful when dynamic = NO). The async argument controls whether the blur will be redrawn on the main thread or in the background. The completion argument is an optional callback block that will be called when the blur is completed.

- (void)setNeedsDisplay;

Inherited from UIView, this method can be used to trigger a (synchronous) update of the view. Calling this method is more-or-less equivalent to calling [view updateAsynchronously:NO completion:NULL].

FXBlurView properties

@property (nonatomic, getter = isBlurEnabled) BOOL blurEnabled;

This property toggles blurring on and off for an individual FXBlurView instance. Blurring is enabled by default. Note that if you disable blurring using the +setBlurEnabled method then that will override this setting.

@property (nonatomic, getter = isDynamic) BOOL dynamic;

This property controls whether the FXBlurView updates dynamically, or only once when the view is added to its superview. Defaults to YES. Note that if dynamic is set to NO, you can still force the view to update by calling setNeedsDisplay or updateAsynchronously:completion:. Dynamic blurring is extremely cpu-intensive, so you should always disable dynamic views immediately prior to performing an animation to avoid stuttering. However, if you have multiple FXBlurViews on screen then it is simpler to disable updates using the setUpdatesDisabled method rather than setting the dynamic property to NO.

@property (nonatomic, assign) NSUInteger iterations;

The number of blur iterations. More iterations improves the quality but reduces the performance. Defaults to 2 iterations.

@property (nonatomic, assign) NSTimeInterval updateInterval;

This controls the interval (in seconds) between successive updates when the FXBlurView is operating in dynamic mode. This defaults to zero, which means that the FXBlurView will update as fast as possible. This yields the best frame rate, but is also extremely CPU intensive and may cause the rest of your app's performance to degrade, especially on older devices. To alleviate this, try increasing the updateInterval value.

@property (nonatomic, assign) CGFloat blurRadius;	

This property controls the radius of the blur effect (in points). Defaults to a 40 point radius, which is similar to the iOS 7 blur effect.

@property (nonatomic, strong) UIColor *tintColor;

This in an optional tint color to be applied to the FXBlurView. The RGB components of the color will be blended with the blurred image, resulting in a gentle tint. To vary the intensity of the tint effect, use brighter or darker colors. The alpha component of the tintColor is ignored. If you do not wish to apply a tint, set this value to nil or [UIColor clearColor]. Note that if you are using Xcode 5 or above, FXBlurViews created in Interface Builder will have a blue tint by default.

@property (nonatomic, weak) UIView *underlyingView;

This property specifies the view that the FXBlurView will sample to create the blur effect. If set to nil (the default), this will be the superview of the blur view itself, but you can override this if you need to.

FAQ

Q. Why are my views all blue-tinted on iOS 7?
A. FXBlurView uses the `UIView` `tintColor` property, which does not exist on iOS 6 and below, but defaults to blue on iOS 7. Just set this property to `[UIColor clearColor]` to disable the tint. To retain iOS 6 compatibility, you can either set this using code, or by using the User Defined Runtime Attributes feature of Interface Builder, which will override the standard `tintColor` value (see the example project nibs for how to do this).

Q. FXBlurView makes my whole app run slowly on [old device], what can I do?
A. To improve performance, try increasing the `updatePeriod` property, reducing the `iterations` property or disabling `dynamic` unless you really need it. If all else fails, set `blurEnabled` to NO on older devices.

Q. My SpriteKit/OpenGL/Video/3D transformed content isn't showing up properly when placed underneath an FXBlurView, why not?
A. This is a limitation of a the `CALayer` `renderInContext:` method used to capture the view contents. There is no workaround for this on iOS 6 and earlier. On iOS 7 you can make use of the `UIView` `drawViewHierarchyInRect:afterScreenUpdates:` method to capture an view and apply the blur effect yourself, but this it too slow for realtime use, so FXBlurView does not use this method by default.

Q. FXBlurView is not capturing some ordinary view content that is behind it, why not?
A. FXBlurView captures the contents of its immediate superview by default. If the superview is transparent or partially transparent, content shown behind it will not be captured. You can override the `underlyingView` property to capture the contents of a different view if you need to.

Release Notes

Version 1.6.4

  • blurredImageWithRadius:iterations:tintColor: now works if image is not in ARGB format
  • Fixed ": CGContextRestoreGState: invalid context 0x0."
  • Empty sublayers are now hidden before snapshotting to prevent renderInContext crash on iOS 8
  • FXBlurView now automatically uses slower drawViewHierarchyInRect method when needed to capture content
  • Added Travis integration

Version 1.6.3

  • FXBlurView image background is no longer opaque/black, so it can be used as a translucent overlay
  • underlyingView property is now an IBOutlet, so it can be connected in Interface Builder
  • Moved imports into header for better Swift compatibility

Version 1.6.2

  • Fixed crash on iOS 8 when animating blur
  • Fixed issue when using FXBlurView with Swift

Version 1.6.1

  • Fixed issue with animation completion block not firing

Version 1.6

  • It is now possible to animate blurRadius
  • Now requires QuartzCore framework

Version 1.5.6

  • Fixed bug introduced in 1.5.4 where snapshot would always be taken from top-left corner of superview

Version 1.5.5

  • Fixed zero-sized context warning in console when view has no presentationLayer

Version 1.5.4

  • It is now possible to animate the FXBlurView frame using ordinary UIView animations

Version 1.5.3

  • Fixed pixelation issue on non-Retina devices running iOS 6 or earlier

Version 1.5.2

  • Fixed bug where edge of blur could be cropped short when using content modes other than scale to fit

Version 1.5.1

  • Fixed bug where completion handler was not called for synchronous blur.

Version 1.5

  • Added underlyingView property to specify source view
  • Added updateAsynchronously:completion: method
  • Fixed glitch with edges on certain views
  • Now conforms to -Weverything warning level

Version 1.4.4

  • Fixed pixelation issue on Retina iPads

Version 1.4.3

  • Fixed error when compiling for iOS 6.1 SDK using Xcode 5

Version 1.4.2

  • Fixed issue where shadow or ghosting could appear at edge of blur view
  • Now conforms to -Wextra warning level

Version 1.4.1

  • Fixed minor memory leak in the setUp method

Version 1.4

  • More intelligent scheduling when multiple dynamic FXBlurView instances are shown on screen at once
  • Added global and individual methods for disabling blur (e.g. so you can disable blur on iPhone 4 and below for consistency with other apps on iOS 7)
  • Added Multiples views example

Version 1.3.3

  • Fixed console warning when adding an FXBlurView of zero size to the window

Version 1.3.2

  • Fixed issue with pixelation on non-Retina devices
  • Tweaked performance/quality tradeoff

Version 1.3.1

  • Improved blur quality (1.3 was slightly blocky)

Version 1.3

  • Added tintColor property
  • Significant performance improvement by reducing snapshot scale based in proportion to blur radius
  • Views placed in front of the FXBlurView in the hierarchy are no longer included in the blur effect
  • Fixed issue where blurView was sometimes partially transparent
  • Added example showing how to implement an iOS7 control center-style overlay
  • FXBlurView now requires ARC

Version 1.2

  • Added +setUpdatesEnabled and +setUpdatesDisabled methods to globally enable/disable dynamic blur updates (e.g. when performing an animation)
  • Added -updateInterval method to control CPU load when updating
  • Changed runloop mode to reduce interference with scrolling, etc

Version 1.1

  • Added ability to set number of blur iterations
  • Fixed setNeedsDisplay behavior when dynamic = NO
  • Reduced memory allocations in blur algorithm
  • Added dynamic mode toggle to example app

Version 1.0

  • Initial release

fxblurview's People

Contributors

ashton-w avatar dbachrach avatar haoyuexing avatar hongrich avatar inamiy avatar javisoto avatar jhollida24 avatar kmy504 avatar mobilevet avatar nicklockwood avatar richy486 avatar ruiaaperes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fxblurview's Issues

MPMoviePlayerController overlay

Looks like it's not possible, but I'll try to ask nonetheless - is there a way to display blur view over MPMoviePlayerController's view playing video?

FXBlurView is occasionally completely transparent

We use FXBlurView as the background for modal view controller presentation. It works great 99% of the time.

Very, very, very infrequently, our view controller is presented and the FXBlurView is completely transparent.

Has anyone else seen this? I'm afraid I can't reproduce it consistently. I imagine it's a race condition where the view to be blurred isn't available in time. Our instance of FXBlurView has dynamic set to NO.

Tint color black

Tint color black is not working whatever im trying to do

Is this a bug?

UIView animations

bildschirmfoto 2013-09-28 um 13 38 43
Hey!

Is it somehow possible to use FXBlurView with animations? I mean in your examples the user can drag the background and it updates dynamically. Now I have a simple blurView and a UILabel underneath it. I animate so it runs behind the blurView from one side to the other and back.

It seems to update only twice. When it's moving out of the blurView the blurView is empty. When the UILabel moves back in (behind) the blurView the blurView updates once to a static state where the text is blurred - the finish state. It seems as if it is generally doing what it should but only updating at the beginning and the end of the animation. Can it update during the animation too?

Dynamic Blur does not work with layer.cornerRadius and NGAParallaxMotion

Hey,
the blurring works great, but it's static. But the dynamic blurring does not work with NGAParallaxMotion (https://github.com/michaeljbishop/NGAParallaxMotion).

And layer.cornerRadius is ignored by this library as well.

_What's wrong here?_

@implementation RoundBlurredView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        [self setupView];

    }
    return self;
}



- (id)initWithCoder:(NSCoder *)aDecoder {

    if(self = [super initWithCoder:aDecoder]) {
        // Initialization code
        [self setupView];
    }

    return self;
}

- (void) setupView
{
    self.layer.cornerRadius = 30;
    [self setDynamic:YES];
    self.blurRadius = 10.0;
}

@end

Dynamic Issues

Ok so i've been using this pretty much from day one, now i have a project which is using UIInterpolatingMotionEffect to move an image (like iOS7 wallpapers) but if i want to display a blur view over the top, even with dynamic on it doesn't seem to pick up the movement of an image so the blur view is never updated.

Blurring time

I'm using the FXBlurView to generate a blur behind a UITableView, which has some pan-able cells.
The thing is I can't interact with any element until blurring is done. Blocking the main thread!

I'm using Dynamic = NO.
The blur instance is created and added in viewDidAppear of the main viewController, blurred view is about 2/3 of the screen, tests are done using a 4th generation iPad.

I need to reduce the blurring time as possible, Any help!

Feature: Font Color For Rect

I have quite a few FXBlurViews with labels on them and with the content behind them changing from a bright color to a dull color (UIImageViews to be exact). I'd really like to be able to pass the FXBlurView the NSRect for the UILabels frame and have it return the best color for the label to make it readable. Even if it just returned white or black for the moment as a proof of concept.

I hope something like this can be implemented.

Issue with uiscrollview

Hi,
I've added a blur view below a uiscrollview, and when i go to scroll the content is very very slow.

How can i fix it?

Thanks in advance.

FXBlurView memory problem

Hello.
First of all, thanks for creating this view and it is really helpful.
I find out a problem with using FXBlurView :
When I subclass FXBlurView and use it, the memory increase from 11MB to 46MB and i do think it affects the performance. It works normal if I subclass UIView (11MB to 12MB).

multiple FXBlurviews turning half black and then full black slowly

I have multiple FXBlurviews on a uiscrollview and they are displaying alright until about 20th one but after 20th they start getting black from bottom and then slowly then go full black when it reaches around 30th...

see attached file:
screen shot 2013-10-11 at 8 36 59 am

I have set dynamic = NO for performance and blurRadius - 15

Also is there a way to create this blur on uitableviewcell? that would be awesome for performance purposes.

thanks

App Crash on Orientation Change

I get a "CGContextRestoreGState: invalid context 0x0" error on orientation change and my app crashes. I have an FXBlurView inside a custom UITableViewCell subclass. My cell class changes the FXBlurView's frame in its layoutSubviews call.

FXBlurView + CustomBadge crash

My app is crashing when im trying to add a custom badge (https://github.com/ckteebe/CustomBadge) inside a FXBlurView, i get this error:
Assertion failed: (CGFloatIsValid(x) && CGFloatIsValid(y)), function void CGPathAddArc(CGMutablePathRef, const CGAffineTransform *, CGFloat, CGFloat, CGFloat, CGFloat, CGFloat, bool), file Paths/CGPath.cc, line 279.

i guess this happens when it tries to restore the blur view, the custom badge cannot calculate it's coords

No Dynamic

Hi,

sorry for my bad english ...

i have set this:
blurview.dynamic = YES;
blurview.blurEnabled = YES;
blurview.blurRadius = 10.0;

In Background is the same parallax effect from iOS 7 homescreen. The blurview show ever the same blur.

Where is the mistake?

Wallpaper background blur iOS7

If we allow application to be non opaque with the following plist key :

UIApplicationIsOpaque NO

and add the following to app delegate

self.window.backgroundColor = [UIColor clearColor];
self.window.opaque = NO;

in order to be able to see the wallpaper background, and then add the FXBlurView,
the background is not getting blurred, the FXBlurView is just dark.

FXBlurView crashes on blurRadius in animationblock in iOS8

I have a problem where I have a Blurview which radius is getting updated in a UIView animationblock crashes.
I am using version 1.6.1 and iOS 8 Beta 3.
The crash is on the device and in the iOS8 simulator.
I have tested the same code on an iOS7 device, which works as intended.

I get a:
-[_UIViewAdditiveAnimationAction duration]: unrecognized selector sent to instance

within:

  • (id)actionForLayer:(CALayer *)layer forKey:(NSString *)key
    {
    if ([key isEqualToString:@"blurRadius"])
    {
    //animations are enabled
    CAAnimation *action = (CAAnimation *)[super actionForLayer:layer forKey:@"bounds"];
    if ((NSNull *)action != [NSNull null])
    {
    CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:key];
    animation.fromValue = [layer.presentationLayer valueForKey:key];
    This line ---> animation.duration = action.duration;
    animation.timingFunction = action.timingFunction;
    animation.timeOffset = action.timeOffset;
    animation.delegate = action.delegate;
    return animation;
    }
    }
    return [super actionForLayer:layer forKey:key];
    }

Any Idea what is wrong?

  • Morten

Blur views not blurring

I can't seem to get my views to blur. There must be something I'm failing to do. I have a blur view in my storyboard behind all of my other views like in the picture. Myblur view I'm doing this in code:

self.blurView.dynamic = NO;
[self.blurView.layer displayIfNeeded];
self.blurView.contentMode = UIViewContentModeBottom;

The BlurView is set to white background so it's at least making that clear

Here's what the IB looks like
screen shot 2013-11-28 at 11 56 30 am

And in action:
screen shot 2013-11-28 at 11 44 32 am

I also tried adding the UIElements into the blur view with no blur either.

performance issue

i was adding a blur view as a tabbarview, but on instruments i notice that the transient bytes is consistently rising without stop. as soon as i removed the blurview from my view, the rising stoped.
I know that the transient bytes is dealloced, but i'm wondering if there is a way to avoid it, because i guess alloc memory also has an impact on performance. (there is about 10GB memory alloced in a few minutes!)
thank you very much

Multiple error with CGContextRestoreGState

Since I use FXBlurView, I'm getting multiple CGContextRestoreGState errors in the console:

<Error>: CGContextRestoreGState: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.

Setting cornerRadius on FXBlurView's CALayer doesn't work

Subclassing FXBlurView, I have tried:

#import <QuartzCore/QuartzCore.h>

...

-(void)awakeFromNib {
    self.layer.cornerRadius = 15.0;
}

It works fine if I change the superclass to UIView, but when using FXBlurView as the parent class, the corner radius remains 0.0.

Use NSInteger instead of int

Getting warnings when compiling a 64-bit build for iPhone 5s. Use NSInteger since NSInteger is now a long on arm64 targets.

FXBlurView.m:214:22: Implicit conversion loses integer precision: 'NSInteger' (aka 'long') to 'int'

FXBlurView.m:444:22: Implicit conversion loses integer precision: 'NSInteger' (aka 'long') to 'int'

I understand this is small and won't provide any benefit other than removing the warning. And I'd never expect to see more than 4294967296 subviews in a view.

Blurview coming as a black color in ios7

I created blur view(FXBlur View) for the uiview it is coming nicely but whenever uiview had background color as a clear color ,blurview coming as a black color .Please look the attachment what i was to say exactly ! Blur view applies for the behind view having clear color has a background color showing as black color

screen shot 2014-05-12 at 1 57 25 pm

FXBlurView leaks

I noticed that you are using the dealloc method of FXBlurView to remove it from NSNotificationCenter. Adding an observer always retains the object that is observing something. Thus dealloc never gets called in the first place. For UIView subclasses that are registered as an observer I usually use didMoveToSuperView in order to remove that observer. In that method you can check whether self.superview == nil.

Anyway, great work!

FXBlurView blocks MainThread

Hi!
I used the FXBlurView in different ViewController which are embedded in a PageViewController. I disabled dynamic during swiping to avoid a strange crash. And now if I swipe very fast between the VCs the app gets in a freezed state and I have to reset the app!

Does anyone have an idea? It looks like updateAsynchronously never stops!

  • (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    self.blurView.dynamic = YES;
    }
  • (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    self.blurView.dynamic = NO;
    }

Resize animation starts from the final size

I use custom UIViewControllerAnimatedTransitioning to open a new controller with its background set as FXBlurView based on presentingController.view. The animation isn't anything fancy โ€“ it basically changes the frame from one to another.

The opening animation is correct, but the closing one is like starting from its final size:

resize-fx

Replacing FXBlurView with [[UIImageView alloc] initWithFrame:self.view.bounds] gives the correct sizing result:

resize-imageview

When I did very similar thing earlier without controllers, using only UIViews it generally worked.

If it's a bug in FCBlurView, I'm willing to try to fix it, but I would be glad if anybody give me some initial thoughts where to start to avoid spending time on unnecessary debugging.

Does not work with AVPlayer

If there is a video in an AVPlayer running in the background.

This library does not seem to detect it. The blurred image is as if the video does not exist.

Is there any way to fix this?

EXC_BAD_ACCESS

FXBlurView crashing after 20 blurred images exactly here

vImageBoxConvolve_ARGB8888(&buffer1, &buffer2, tempBuffer, 0, 0, boxSize, boxSize, NULL, kvImageEdgeExtend);

I'm calling the images

UIImage *img = [artwork imageWithSize:_blurredCover.bounds.size];
img = [img blurredImageWithRadius:8.0f
iterations:3
tintColor:[UIColor whiteColor]];
_blurredCover.image = img;

Blur radius and UIView animation completion block

I use blur radius in UIView animation block (e.g your sample code "AnimatedBlurExample"). My problem is the completion block of [UIView animateWithDuration:completion:] is never called.

- (IBAction)toggleBlur
{
    if (self.blurView.blurRadius < 5)
    {
        [UIView animateWithDuration:0.5 animations:^{
            self.blurView.blurRadius = 40;
        } completion:^(BOOL finished) {
            NSLog(@"NEVER CALLED");
        }];
    }
    ...
}

This sample come from you sample code "AnimatedBlurExample".

Laggy?

Thanks for FXBlurView. It looks great.
Are there tricks to getting the FXBlurView fast?
Are there non recommended view hierarchies?
We have tried FXBlurView and it works great in the example Apps, but not so much in our Views. :-(

- (UIImage *)blurredImageWithRadius:iterations:tintColor: assumes image is in ARGB format

- (UIImage *)blurredImageWithRadius:iterations:tintColor: assumes image is in ARGB format, leading to crashes (EXEC_BAD_ACCESS) if image is not in that format.

You can reproduce with this example that uses a 8bit per pixel png indexed image:

UIImage *img = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://data3.whicdn.com/images/84761236/large.png"]]];
[img blurredImageWithRadius:10 iterations:10 tintColor:nil];

FXBlurView doesnt work properly in Landscape Orientation

Hello. I'm using FXBlurView as a container for my popover. Popover presents as modal view in UIModalPresentationCurrentContext.
Unfortunately FXBlurView don't work properly in my case. I use Landscape orientation for my app, but screenshot of superview is in Portrait orientation.
Here is screenshot:
2013-10-14 3 44 30

Error messages in the console

I'm using FXBlurView above a collection view. The result seems good but I'm having a lot of error messages in the console. I'm not animating the FXBlurView, I also tried without subclassing it and I still have the warnings.

My FXBlurView is instantiated by a nib and linked to the VC via an outlet. I don't believe I'm doing something wrong here.

Here's the console output:

Mar 10 12:17:57 <Error>: CGContextTranslateCTM: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
Mar 10 12:17:57 <Error>: CGContextSaveGState: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
Mar 10 12:17:57 <Error>: CGContextSaveGState: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
Mar 10 12:17:57 <Error>: CGContextSetFillColorWithColor: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
[...]

Thanks for your help ;)
Cheers.

FXBlurView and animations

Hi,

I try to use your great class but i have problems with animations, I have a FXBlurView with a scrollView behind but when i use :
[UIView animateWithDuration:1.5
delay:0
options:UIViewAnimationOptionCurveEaseInOut
animations:^{ [self.scrollView scrollRectToVisible:frame animated:NO]; }
completion:NULL];

The blur effect doesn't show the good image. It take directly the result of the animation.
Same if i try to animate the FXBlurView to the bottom to top or top to bottom, the blur take the result of the animation directly.

I use autolayout if it's matter.
Can you help me with this ?

Blur Radius when updateAsynchronously: called

UIImage *snapshot = [self snapshotOfUnderlyingView];
if (async)
{
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{

        UIImage *blurredImage = [self blurredSnapshot:snapshot radius:self.blurRadius];
        dispatch_sync(dispatch_get_main_queue(), ^{

            [self setLayerContents:blurredImage];
            if (completion) completion();
        });
    });
}
else
{
    [self setLayerContents:[self blurredSnapshot:snapshot radius:[self blurPresentationLayer].blurRadius]];
    if (completion) completion();
}

Blur radius value is different when using asynchronous and synchronous update (dynamic - NO)

Asynchronous

UIImage *blurredImage = [self blurredSnapshot:snapshot radius:self.blurRadius];

Synchronous

[self setLayerContents:[self blurredSnapshot:snapshot radius:[self blurPresentationLayer].blurRadius]];

Crash

after i scroll the underlying map view it crashes

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType _isChargeEnabled]: unrecognized selector sent to instance 0xaae7730'
*** First throw call stack:

Transparency switching?

Is it possible to quickly turn an FXBlurView transparent (but still maintain a border)? Disabling blur just seems to stop updating the blur, but I'm curious if it is possible to quickly toggle between transparency and blurring.

FXBlurView crash when close the photo's authorization of the project while app running

When Using FXBlurView in my project,

    FXBlurView *blurView = [[FXBlurView alloc] initWithFrame:self.view.bounds];
    blurView.tintColor = [UIColor clearColor];
    blurView.blurRadius = 1;
    blurView.iterations = 20;
    blurView.tintColor = [UIColor colorWithWhite:0 alpha:0.5f];
    blurView.updateInterval = 0.1f;
    [self.view addSubview:blurView];

When the app is running, I switch to the background and turn off the photo's authorization of the app,then FXBlurView crash.Below is the crash stack.
b84ad01c-39af-4bf0-9372-c664e9cfe845

Black shadow on clear FXBlurView over white view

A white view containing a clear FXBlurView.

The view is touching the edge of the screen on the right-hand side but it happened exactly the same when the right-hand side of the view was touching another cell (independently of the color of that other cell)

captura de pantalla 2013-10-04 a la s 10 03 52 am

expand on changing the tint color

I have tried putting

self.FXBlurView.tintColor = [UIColor clearColor];

Inside the viewdidload on my .m where the uiview is nested. But that does not work?
I have also done

#import "FXBlurView.h"

on the .m

How are you supposed to do it?

I have also tried this:

FXBlurView *BlurView = [[FXBlurView alloc] init];
BlurView.tintColor= [UIColor clearColor];

Sorry for my ignorance

blurView messes with sibling imageView (transparent png with `UIInterpolatingMotionEffect`)

I'm adding a blurView as a child of a view that has a UIImageView child that contains a transparent png with a UIInterpolatingMotionEffect applied to it.

i.e. in my UIViewController subclass I'm adding the UIImageView instance and then a blurView instance.

The transparent png is a fullscreen image with a little white pattern applied to it. The whole png has transparency, so even the parts occupied by the white pattern shapes are only about 0.4 alpha.

When I add the blurView the white areas of the image seem to become inverted, now dark gray. This only happens when I add the blurView to the view hierarchy.

See screenshot below (blurView occupies only the top 54 pixels of the screen. It properly blurs the white flecked pattern behind it. But the pattern over the rest of the screen space is inverted (white is now dark gray).

Any ideas how to prevent this from happening?

screenshot 2013 10 19 00 18 34

FXBlurView not working for UIImagePickerController cameraOverlayView

I want the blur effect to my custom camera over lay view.
When I use FXBlurView for UIImagePickerController cameraOverlayView I am getting blue color view.
In the below image, the blue UIView's in the top and bottom are FXBlurView objects.
Initially, I set white color to both FXBlurView objects. Please suggest, how to get blue color parts as blur.
img_0966

Pixelated on non-retina devices

I experienced an issue that when using FXBlurView on non retina devices, the blur is showing big pixels instead of an smooth blur.
bildschirmfoto 2013-09-04 um 16 35 09

Snapshot bug on UINavigationBar/UIToolbar using iOS 7

Since Apple added blurring effects to their UIToolbar & UINavigationBar, the snapshot method produces a black shadow over those UI elements (see below)
image

I managed to fix this bug on iOS 7.0.x, but it reappeared on iOS 7.1beta.
As 7.1 is currently in beta, I won't ask you to fix it, 'cause I still hope Apple will...
Just wanted to tell you how I fixed it under 7.0.x : I just use -setTranslucent:NO on UIToolbar/UINavigationBar right before screenshoting, then restore the previous translucent value.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.