Reputation: 585
I have a UIView which I apply a layer mask to. It works great on every device except for the retina iPad. On the retina iPad, the view that is being masked doesn't show up. If I remove the mask, the view shows up on the retina iPad.
The mask is very simple. It shows the entire view except for a small triangle taken out of the bottom edge.
contentView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] applicationFrame].size.width, [[UIScreen mainScreen] applicationFrame].size.height - 50.0)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
CGMutablePathRef path = CGPathCreateMutable();
float triangleDepth = 10;
CGPathMoveToPoint(path, NULL, 0, 0);
CGPathAddLineToPoint(path, NULL, contentView.frame.size.width, 0);
CGPathAddLineToPoint(path, NULL, contentView.frame.size.width, contentView.frame.size.height);
CGPathAddLineToPoint(path, NULL, (contentView.frame.size.width / 2.0) + triangleDepth, contentView.frame.size.height);
CGPathAddLineToPoint(path, NULL, (contentView.frame.size.width / 2.0), contentView.frame.size.height - triangleDepth);
CGPathAddLineToPoint(path, NULL, (contentView.frame.size.width / 2.0) - triangleDepth, contentView.frame.size.height);
CGPathAddLineToPoint(path, NULL, 0, contentView.frame.size.height);
CGPathCloseSubpath(path);
[maskLayer setPath:path];
CGPathRelease(path);
contentView.layer.mask = maskLayer;
contentView.clipsToBounds = NO;
[self.view addSubview:contentView];
This code runs for every device, so what is different about the retina iPad that would prevent this from working?
Upvotes: 1
Views: 247
Reputation: 585
This was just a problem with the iOS Simulator. I finally got to try the code on a retina iPad, and everything worked just fine.
Upvotes: 1