我正在尝试在透明图像后面添加渐变。我在地图 leftCallOutAccessoryView 上执行此操作,但是无论我尝试什么,渐变层总是显示在 imageView 上方并希望它出现在它后面
这是我的 MKAnnotationView 代码,它是一个名为 pinView 的 ivar
pinView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
UIImageView *profileIconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Profile.png"]];
pinView.leftCalloutAccessoryView = profileIconView;
CAGradientLayer *backgroundLayer = [CAGradientLayer layer];
backgroundLayer.frame = CGRectMake(0, 0, 30, 30);
backgroundLayer.cornerRadius = 2;
backgroundLayer.borderWidth = 1;
backgroundLayer.borderColor = [UIColor whiteColor].CGColor;
backgroundLayer.colors = [NSArray arrayWithObjects:(id)[[sharedManager cellGradientEnd] CGColor], (id)[[sharedManager cellGradientStart] CGColor], nil];
[profileIconView.layer insertSublayer:backgroundLayer atIndex:0];