我得到了答案。使用下面的代码并在边界处为两幅图像添加渐变遮罩。您可以将第二个图像视图框架的某些像素向上移动到第一个图像,这样第一个图像视图边框和第二个视图边框将完全合并。
-(void)addGradientTo:(UIImageView*)imageView {
CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.frame = imageView.bounds;
gradient.colors = [NSArray arrayWithObjects:
(id)[[UIColor colorWithWhite:0 alpha:0.2] CGColor],
(id)[[UIColor colorWithWhite:0 alpha:1] CGColor],
(id)[[UIColor colorWithWhite:0 alpha:1] CGColor],
(id)[[UIColor colorWithWhite:0 alpha:0.2] CGColor], nil];
gradient.locations = [NSArray arrayWithObjects:
[NSNumber numberWithFloat:0],
[NSNumber numberWithFloat:.1],
[NSNumber numberWithFloat:.9],
[NSNumber numberWithFloat:1], nil];
gradient.startPoint = CGPointMake(0,0.3);
gradient.endPoint=CGPointMake(1,0.3);
[imageView.layer setMask:gradient];
}