ios-realtimeblur icon indicating copy to clipboard operation
ios-realtimeblur copied to clipboard

Change blur view position with animation

Open sarperdag opened this issue 12 years ago • 4 comments

Looks like this doesn't work correct. Trying to build something like the control center in iOS7. So if I try to present a blur view modally from the bottom of the window, the blur view isn't real time. Just statically contains its background and doesn't change as it's animated.

Any ideas how to implement this?

sarperdag avatar Jul 24 '13 15:07 sarperdag

    //take screenshot of current view
    UIGraphicsBeginImageContext(self.view.bounds.size);
    [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    //Get blur from screenshot
    NSData *imageData = UIImageJPEGRepresentation(viewImage, kDRNRealTimeBlurViewScreenshotCompression);
    UIImage *image2 = [[UIImage imageWithData:imageData] drn_boxblurImageWithBlur:kDRNRealTimeBlurViewBlurRadius];

    //crop image to my rect
    CGRect cropRect = CGRectMake(0, [[UIScreen mainScreen] bounds].size.height - kSupporterHeight, kSupporterWidth, kSupporterHeight);
    CGImageRef imageRef = CGImageCreateWithImageInRect([image2 CGImage], cropRect);

    //init and hide image to animate entry
    _scrollViewBackgoundView = [[UIImageView alloc] initWithImage:[UIImage imageWithCGImage:imageRef]];
    [_scrollViewBackgoundView setFrame:CGRectMake(0, screenRect.size.height, kSupporterWidth, kSupporterHeight)];
    [self.view addSubview:_scrollViewBackgoundView];

marioEAE avatar Jul 26 '13 11:07 marioEAE

This was my workaround, i also had the same problem... (you can check on closed issues)

marioEAE avatar Jul 26 '13 11:07 marioEAE

Yeah we implemented a similar solution too and now it's working. Thanks for the help!

Sarp Erdag Sent from my iPhone

On 26 July 2013 Friday at 14:44, marioEAE wrote:

This was my workaround, i also had the same problem... (you can check on closed issues)

— Reply to this email directly or view it on GitHub (https://github.com/alexdrone/ios-realtimeblur/issues/8#issuecomment-21615801).

sarperdag avatar Jul 26 '13 11:07 sarperdag

I've got a different animation scenario that i think it's not solved by this workaround. It's this:

When i move the blurred view with UIView animations, the blur doesn't get updated while it's animating. I think it's possible to do that but i haven't found a way out. How can it know it's inside an UIView animation, and update its content? Anybody got suggestions?

Thanks.

jvjvdev avatar Jul 30 '13 12:07 jvjvdev