I have a UITableView
with a UIImageView
as the backgroundView
. This works like a charm. However, now I'm trying to blur this image (using UIVisualEffectView
) so that the background of the tableView looks blurred. However, my code somehow ignores the image and simply blurs the white background of the table view. Here is the code:
UIImageView *tempImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"sidebarImage"]];
UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
UIVisualEffectView *blurEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
[blurEffectView setFrame:tempImageView.bounds];
[tempImageView addSubview:blurEffectView];
self.tableView.backgroundView = tempImageView;
EDIT: After some more testing, I found that this works on the simulator, but not on the actual device. I have attached screenshots below a well. What's even more surprising is that when I comment out [tempImageView addSubview:blurEffectView]
; the image shows up. That means the image is being copied to the phone.