I would like to set an image as UINavigationController background but most solutions I found apply background in navigation bar for all views in the app. Can you give some code that may help ?
Thx for helping,
Stephane
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.
Here’s a quick and dirty way that I use in one of my projects (I have no need to support landscape orientation). I implemented it with a category to
UINavigationBarwith method swizzling. Works on iOS 4 and 5 (I didn’t try it on iOS 3).UINavigationBar+SYCustomBackground.h
UINavigationBar+SYCustomBackground.m
Then you set your background images in
viewWillAppearand restore them inviewWillDisappearif you want to change images in oneUINavigationController.It’s not perfect, I would add some crossfade transition, add push/pop for backgrounds, but I have no time yet, so feel free to improve it.