Iphone UIImageView中的边框

Iphone UIImageView中的边框,iphone,uiimageview,objective-c++,Iphone,Uiimageview,Objective C++,我正在尝试使UIImageView具有如下边框: 我试过使用: [imageView.layer setBorderColor: [[UIColor whiteColor] CGColor]]; [imageView.layer setBorderWidth: 2.0]; 但是你看不到外面灰色的边界。它的外部有灰色阴影效果。 如何执行此操作?请查看CALayer的阴影属性 [imageView.layer setShadowOffset:CGSizeMake(-1.0, -1.0)]; [i

我正在尝试使UIImageView具有如下边框:

我试过使用:

[imageView.layer setBorderColor: [[UIColor whiteColor] CGColor]];
[imageView.layer setBorderWidth: 2.0];
但是你看不到外面灰色的边界。它的外部有灰色阴影效果。
如何执行此操作?

请查看CALayer的阴影属性

[imageView.layer setShadowOffset:CGSizeMake(-1.0, -1.0)];
[imageView.layer setShadowOpacity:0.5];
关于向UIImageView添加阴影可能会有所帮助

imageView.layer.shadowOpacity=0.6;
imageView.layer.shadowRadius = 0.0;
imageView.layer.shadowColor = [UIColor grayColor].CGColor;
imageView.layer.shadowOffset = CGSizeMake(-2.0, 1.0);