Saeed
Saeed

Reputation: 88

how to remove border line in custom uiview?

enter image description here

I made a custom view and I called it in UINavigationController, I made it transparent but after I put it inside navigation controller I got that border, how to remove it? thanks in advance

Upvotes: 1

Views: 10841

Answers (4)

Tuan Huynh
Tuan Huynh

Reputation: 596

Update on Swift 3+

yourview.layer.borderColor = UIColor.clear.cgColor

Upvotes: 1

Hosny
Hosny

Reputation: 831

Try to set border width of your view with 0

yourView.layer.borderWidth = 0

Upvotes: 8

Md. Ibrahim Hassan
Md. Ibrahim Hassan

Reputation: 5467

Try this code out. (91,158,236) is the color of your navigation bar.

yourview.layer.borderColor = UIColor(red: 91.0 / 255, green: 158.0 / 255, blue: 236.0 / 255, alpha: 1.0).CGColor

For a red View contained in navigation Bar for a borderWidth of 4.0 it would produce result like

enter image description here

Hope this helps.

Upvotes: 0

Sandro Machado
Sandro Machado

Reputation: 10205

You need to set the border color of your view transparent.

yourview.layer.borderColor = UIColor.clearColor()

This should work.

Upvotes: 1

Related Questions