左側(cè)按鈕多出20像素解決方案: if ([[[UIDevice currentDevice]systemVersion]floatValue]>=7.0?20:0) {
UIBarButtonItem *negativeSpace=[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
negativeSpace.width=-19;
self.navigationItem.leftBarButtonItems=@[negativeSpace,[[UIBarButtonItem alloc]initWithCustomView:self.leftButton]];
}else{
self.navigationItem.leftBarButtonItem=[[UIBarButtonItem alloc]initWithCustomView:self.leftButton];
}
pragma mark---高斯模糊
- (UIImage *)blurryImage:(UIImage *)image withBlurLevel:(CGFloat)blur{
CIImage *inputImage=[CIImage imageWithCGImage:image.CGImage];
CIFilter *filter=[CIFilter filterWithName:@"CIGaussianBlur" keysAndValues:kCIInputImageKey,inputImage,@"inputRadius", @(blur),nil];
CIImage *outPutImage=filter.outputImage;
CIContext *context=[CIContext contextWithOptions:nil];
CGImageRef outImage=[context createCGImage:outPutImage fromRect:[inputImage extent]];
return [UIImage imageWithCGImage:outImage];
}
使用方法: dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSData *data=[NSData dataWithContentsOfURL:[NSURL URLWithString:_AlbumListModel.album.coverLarge]];
dispatch_async(dispatch_get_main_queue(), ^{
[_imageView setImage:[self blurryImage:[UIImage sd_imageWithData:data] withBlurLevel:9] ];
});
});