开发者

How do I create a white border and black shadow for my UIImageView?

开发者 https://www.devze.com 2023-03-08 05:56 出处:网络
How do I create开发者_如何学运维 a white border and black shadow for my UIImageView?Just import

How do I create开发者_如何学运维 a white border and black shadow for my UIImageView?


Just import

#import  <QuartzCore/QuartzCore.h> 

and make sure that you have the QuartzCore framework added to your project.

Then to add border

[imageView.layer setBorderColor: [[UIColor whiteColor] CGColor]];
[imageView.layer setBorderWidth: 2.0];

To create shadow, see this SO question, which will get you going..


this is the way I add a border and shadow to an UIImage in a UIMageView

someImageView.image = someUIImage;
someImageView.frame = CGRectMake(45, 25, 50, 50);
[someImageView.layer setBorderColor: [[UIColor whiteColor] CGColor]];
[someImageView.layer setBorderWidth: 2.0];
[someImageView.layer setShadowOffset:CGSizeMake(-3.0, 3.0)];
[someImageView.layer setShadowRadius:3.0];
[someImageView.layer setShadowOpacity:1.0];

remember:

#import  <QuartzCore/QuartzCore.h>


You can just add it as another UIImageView behind the one showing your image.

0

精彩评论

暂无评论...
验证码 换一张
取 消