I’m trying just to create a simple gradient with a label on it that I can overlay on top of a MKMapView. I looked on SO and saw I could use CAGradientLayer rather than override drawRect in UIView. I thought I would give it a shot. In my viewDidLoad, I do this:
CGRect frame = CGRectMake(self.mapView.frame.origin.x, self.mapView.frame.origin.y, 320.0, 44.0);
CAGradientLayer *gradientLayer = [CAGradientLayer layer];
gradientLayer.frame = frame;
gradientLayer.backgroundColor = (__bridge CGColorRef)((__bridge id)([UIColor clearColor].CGColor));
[gradientLayer setCornerRadius:12.0];
[gradientLayer setOpacity:0.5];
gradientLayer.colors = @[(id)[UIColor blackColor].CGColor, (id)[UIColor whiteColor].CGColor];
[self.view.layer addSublayer:gradientLayer];
It’s on the right path, except the upper left corner and upper right corner have this white underneath. Is there a reason for this? I thought it might be because I didn’t set the backgroundColor of the layer or something since that has happened to me on UIViews before, but it doesn’t seem like it.

Thanks!
The corners don’t have white underneath. They have map underneath. Here are the four corners, zoomed 600%:
When you set the corner radius of a layer, you’re clipping that layer. Anything under the layer will show through where you’ve clipped the rounded layer away.
In your case, you’ve clipped your gradient layer’s corners off, so the map layer underneath shows through without being blended with the gradient.
You need to clip your map layer’s corners also. The easiest way is to set the same corner radius on your map layer.