Reputation: 151
I'm making an iOS app which includes 2 UITableViewController, Pressing on the first tableview cell pushes the second tableview, the transition was pretty fast (going back/forth between the two tableviews) until i used this code on each tableviews viewWillAppear method:
UIImageView *imageV = [[UIImageView alloc] init];
UIImage *image = [[UIImage imageNamed:@"un.jpeg"] applyBlurWithRadius:50
tintColor:nil
saturationDeltaFactor:1
maskImage:nil];
imageV.image = image;
self.tableView.backgroundView = imageV;
Now the transition takes about 2-3 seconds to be done how can i improve transition speed ?
Edit 1: using UIImage+ImageEffects.h from Apple to blur the image
Edit 2 (solution):
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
UIImageView *imageV = [[UIImageView alloc] init];
UIImage *image = [[UIImage imageNamed:@"un.jpeg"] applyBlurWithRadius:50
tintColor:nil
saturationDeltaFactor:1
maskImage:nil];
imageV.image = image;
self.tableView.backgroundView = imageV;
});
Upvotes: 0
Views: 70
Reputation: 535178
I would suggest applying the blur on a background thread, so it doesn't slow your interface down. And you might want to look into GPUImage for maximum speed.
Alternatively, in iOS 8, just use the UIBlurEffect that is built in. But of course that is a much less flexible blur.
Upvotes: 1
Reputation: 26385
Is not setting the image per se, is applying the blur on it.
The bigger is the image the longer it takes. I don't know which kind of functionalities you are using to make the image blurred, but check if you can use the accelerate framework or Core Image on GPU to perform the operation faster.
Upvotes: 0
Reputation: 3955
What slows your application the most is certainly not the image, but rather the blur that you apply to it.
Upvotes: 1