How do I create a white border and black shadow for my UIImageView?
Asked
Active
Viewed 2,378 times
3 Answers
5
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..

Community
- 1
- 1

Krishnabhadra
- 34,169
- 30
- 118
- 167
-
1Just make sure that you import
and make sure that you have the QuartzCore framework added to your project. – Rexeisen May 26 '11 at 04:40 -
That is the right way to add the border using quartz core framework....+1 for you... – Sabby May 26 '11 at 05:43
-
yes @Rexeisen, forgot about includes and frameworks..Thanks for noting that..Will edit my answer.. – Krishnabhadra May 26 '11 at 06:04
-
ok.After this my problem is,How to access the jailbreak iphone root directory.My main theme is set the wallpaper for everymonth.And get that wallpaper from database.assign and storing to database is completed.But how to access the jail break iphone.Please give me the right direction for doing this one.please – Venkat1282 May 26 '11 at 09:43
3
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>

felbus
- 2,639
- 2
- 24
- 30
1
You can just add it as another UIImageView behind the one showing your image.

Chris Cooper
- 17,276
- 9
- 52
- 70