When contents inside UIScrollView been trimmed away by flat edges, it looks looks weird on blurred view.
All we need to do is customize mask layer for our UIScrollView. For example I add a mask layer to UITableView.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CAGradientLayer *maskLayer = [CAGradientLayer layer]; | |
CGColorRef outerColor = [UIColor colorWithWhite:1.0 alpha:0.0].CGColor; | |
CGColorRef innerColor = [UIColor colorWithWhite:1.0 alpha:1.0].CGColor; | |
maskLayer.colors = @[(__bridge id)outerColor, (__bridge id)innerColor]; | |
maskLayer.locations = @[@0, @.05]; | |
maskLayer.bounds = self.tableView.bounds; | |
maskLayer.anchorPoint = CGPointZero; | |
maskLayer.position = CGPointMake(0, -self.tableView.contentInset.top); | |
self.tableView.layer.mask = maskLayer; |