I have a custom view which I would like to look like a UINavigationBar. Is there a way for me to draw the background the same way a UINavigationBar would?
I don’t want to draw an image or a gradient fill that looks like a UINavigationBar – I want to use the same library code (if it is public) that a UINavigationBar does to draw its background.
The
drawRect:method of aUINavigationBaris private – you can’t use it to draw the background of your own view.The easiest way round this would be to take a screen shot, trim the image to nav bar size, add to your project, and then either draw the image in your view’s
drawRect:method, or add aUIImageViewas a subview of your view.Alternatively, would it be possible to use a
UIToolbarinstead of your custom view?