我正在使用 RNBlurModalView ( https://github.com/rnystrom/RNBlurModalView ) 来模糊我的模态视图的背景。问题是当我滚动我的表格视图时,屏幕截图也不会滚动。当您滚动时,模糊最终会消失。我知道我需要使用表格视图的内容偏移量,但不确定如何在现有代码中实现它
RNBlurModalView.m
#pragma mark - UIView + Screenshot
@implementation UIView (Screenshot)
- (UIImage*)screenshot {
UIGraphicsBeginImageContext(self.bounds.size);
[self.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
// hack, helps w/ our colors when blurring
NSData *imageData = UIImageJPEGRepresentation(image, 1); // convert to jpeg
image = [UIImage imageWithData:imageData];
return image;
}
@end
还有我实现视图的代码
- (IBAction)locationPressed:(id)sender {
UIStoryboard *storyBoard = [self storyboard];
HomeViewController *homeView = [storyBoard instantiateViewControllerWithIdentifier:@"HomeViewController"];
RNBlurModalView *modal = [[RNBlurModalView alloc] initWithViewController:self title:@"Hello world!" message:@"Pur your message here."];
[modal show];
[self presentPopupViewController:homeView animationType:MJPopupViewAnimationSlideBottomBottom];
有任何想法吗?
谢谢。