View Full Version : Putting a black border around a view?

Nov 7, 2008, 01:44 PM
Is there an easy way to put a black border around a view? I can set a backgroundColor to like yellow, but I want the edges to be black.

Only thing that comes to mind for me is to use an UIImageView and stick it behind. That seems kinda cumbersome, especially when I plan to move some of these views with touches.

Nov 7, 2008, 03:44 PM
Use a UIImageView, added as a subview. I think if you assign it a UIImage with that you make stretchable with stretchableImageWithLeftCapWidth:topCapHeight: you will be able to scale and move the superview without a poblem. Just be sure to set the image view to the proper autoresizeMask it should be no problem.

This method should even allow you to create pretty rounded corners or something.