Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change blur view position with animation #8

Open
sarperdag opened this issue Jul 24, 2013 · 4 comments
Open

Change blur view position with animation #8

sarperdag opened this issue Jul 24, 2013 · 4 comments

Comments

@sarperdag
Copy link

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?

@marioEAE
Copy link

    //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
Copy link

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

@sarperdag
Copy link
Author

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 (#8 (comment)).

@jvicjvic
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants