Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Corner radius for a navigation bar

Tags:

iphone

i have developed an iPad app. In that app i have 4 separate views embedded inside a single view controller and there is a navigation bar for each view.I want to set the corner radius of each navigation bar.

i tried

       customNavigationBar.layer.cornerRadius = 25;

but this piece of code is not working. Does anyone know how to set the corner radius for each navigation bar.

like image 854
Sandy Avatar asked Mar 14 '12 10:03

Sandy


People also ask

How do you define corner radius?

The corner radius is a measurement describing the curve on the corners of your labels. This is measured in millimetres and refers to the radius of the circle created if the curve was extended to create a full circle.

How do you add corner radius to a label?

"label. layer. masksToBounds = true" is an important code, if you apply corner radius to a label and if it dosen't work than adding this will definitely add the corner radius to a particular label.. So this should be the correct answer..


1 Answers

customNavigationBar.layer.cornerRadius=25;
customNavigationBar.clipsToBounds=YES;

i have tested it successfully

like image 170
hayden Avatar answered Sep 21 '22 20:09

hayden