What I did was I rasterized the image and then return it to its high quality version by turning off the shouldRasterized property. Here, take a look at my source codes.
SHOWING UI ELEMENTS
- (void)showTopElements { self.photoButton.layer.shouldRasterize = YES; self.videoButton.layer.shouldRasterize = YES; self.photoButton.layer.shouldRasterize = YES; self.videoButton.layer.shouldRasterize = YES; [UIView transitionWithView:self.photoButton duration:0.5 options:UIViewAnimationOptionTransitionCrossDissolve animations:NULL completion:NULL]; [UIView transitionWithView:self.videoButton duration:0.5 options:UIViewAnimationOptionTransitionCrossDissolve animations:NULL completion:NULL]; [UIView transitionWithView:self.searchButton duration:0.5 options:UIViewAnimationOptionTransitionCrossDissolve animations:NULL completion:NULL]; [UIView transitionWithView:self.coverView duration:0.5 options:UIViewAnimationOptionTransitionCrossDissolve animations:NULL completion:NULL]; // self.photoButton.hidden = YES; self.videoButton.hidden = NO; self.searchButton.hidden = NO; self.coverView.hidden = NO; [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationSlide]; [self setNeedsStatusBarAppearanceUpdate]; }
HIDING UI ELEMENTS
- (void)hideTopElements { self.photoButton.layer.shouldRasterize = YES; self.videoButton.layer.shouldRasterize = YES; self.photoButton.layer.shouldRasterize = YES; self.videoButton.layer.shouldRasterize = YES; [UIView transitionWithView:self.photoButton duration:0.5 options:UIViewAnimationOptionTransitionCrossDissolve animations:NULL completion:NULL]; [UIView transitionWithView:self.videoButton duration:0.5 options:UIViewAnimationOptionTransitionCrossDissolve animations:NULL completion:NULL]; [UIView transitionWithView:self.searchButton duration:0.5 options:UIViewAnimationOptionTransitionCrossDissolve animations:NULL completion:NULL]; [UIView transitionWithView:self.coverView duration:0.5 options:UIViewAnimationOptionTransitionCrossDissolve animations:NULL completion:NULL]; // self.photoButton.hidden = YES; self.videoButton.hidden = YES; self.searchButton.hidden = YES; self.coverView.hidden = YES; [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide]; [self setNeedsStatusBarAppearanceUpdate]; }
If you can't understand the codes here or need some help, comment here and email me.
Post a Comment