NJUHOBBY
NJUHOBBY

Reputation: 850

how to add another border around a border?

Now i have a problem with my iphone project. I already have a UIView with a white color border around it and I'm wondering how can I put another grey border just outside the white one, which makes the view looks like a photo frame. Please help me, guys.

Upvotes: 0

Views: 105

Answers (2)

iOS Test
iOS Test

Reputation: 1103

You may try this an alternate option. Create 4 uiview:Left,right,top bottom and make the height as per ur border height may be 2 pixels.

Uiview*leftVw = [[Uiview alloc]initwithFrame:cgrectmake(x,y,w,2)];
leftview.backgroundcolor = [uicolor graycolor];
[self.view addsubview leftview];

Uiview*rightVw = [[Uiview alloc]initwithFrame:cgrectmake(x,y,w,2)];
[self.view addsubview rightview];

Uiview*topVw = [[Uiview alloc]initwithFrame:cgrectmake(x,y,w,2)];
[self.view addsubview topview];

Uiview*bottomVw = [[Uiview alloc]initwithFrame:cgrectmake(x,y,w,2)];
[self.view addsubview bottomview];

Adjust the frame of each view.

Upvotes: 1

Dominik Hadl
Dominik Hadl

Reputation: 3619

Create the border in photoshop and then just display an UIImageView with appropriate size. Or you can create an UIView, that doesn't have any subviews and add a border to it.

Upvotes: 2

Related Questions