Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jschulbach

macrumors newbie
Original poster
Jun 29, 2010
15
0
I've got a couple of UIImageViews that are square but contain either tall or wide images with aspect fill so they fill the square. If I wanted a border around these images what is an easy way to do that? I didn't see a border option for image views in IB so would I want to just put another image view behind them that is 1px larger in each direction? What is the best way to go about adding the border?
 

jschulbach

macrumors newbie
Original poster
Jun 29, 2010
15
0
I think I found a good solution. I just used a view with the background color set to my border color, sized 1px larger than the UIImageView on each side. I was mostly concerned about efficiency and what method would affect performance the least but this method seems pretty simple.
 

PBG4 Dude

macrumors 601
Jul 6, 2007
4,267
4,479
That's a neat and easy solution! I would've been bordering my images instead of this simple idea. :) Thanks for posting.
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
You could try playing with the image view's layer which has a borderColor and borderWidth property, but that may not work on the UIImageView.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.