Custom UINavigationController UIToolbar subclass
Asked Answered
T

1

2

I need to work with a subclassed UIToolbar in the UINavigationController. I know this can be done via Interface Builder but I need it to be done programatically.

The docs state that the UINavigationController toolbar property is readonly so I'm at a bit of a loss as to how I proceed.

Related:

Tm answered 2/4, 2013 at 14:49 Comment(0)
C
5

A new init* method has been available since iOS 5

- (instancetype)initWithNavigationBarClass:(Class)navigationBarClass 
                              toolbarClass:(Class)toolbarClass

Also don't forget

... you are responsible for adding a root view controller before presenting the navigation controller onscreen.

Caspian answered 2/4, 2013 at 14:53 Comment(3)
Perfect, missed this. Thanks @Paul.s!Tm
Where do I add this init method?Erective
You need to create the navigationController using this method. So where ever you create your navigation controller use this instead.Caspian

© 2022 - 2024 — McMap. All rights reserved.