Is it possible to have an invisible navigation bar background? I’ve seen custom ones before, but would love some guidance on how to do this.
Thanks in advance!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To get a transparent background on a UINavigationBar or UIToolbar, you have to set the background color to
[UIColor clearColor], setopaqueto NO (if it isn’t already), and overridedrawRectto not draw the standard gradient background. The third is the tricky part.If you’re using UINavigationBar directly, you can easily enough just subclass it to override
drawRect. But I see you tagged this with UINavigationController, so you’ll have to try overriding it with a category. Something like this should do it:That has the drawback that every navbar in your app will now have no background. If you want to be able to have some transparent and some normal, you have to go one step further and swizzle
drawRectso you can call the original when needed: