ios - Improving the portability of UIViewControllers that require a UINavigationBar -
we try reuse our view controllers, whether pushed navigation controller or presented. however, things can little hairy when explicit uinavigationbar part of view controller's function design.
if set view controller's navigation item, pushing navigation controller works expected, presenting results in no navigation bar @ all. on other hand, if explicitly add , configure uinavigationbar view, presenting works fine, pushing results in double navigation bars. while specify parent navigation controller's navigation bar hidden view, creates clumsy animated transition when pushing or popping view controller.
(in perfect world, imagine navigationbar property managed uiviewcontroller instead of uinavigationcontroller. alas, that's not case, here am.)
what of best practices people here have found maintain portability of view controllers requiring uinavigationbar?
i've handled in 1 of 2 ways:
i fall asserting
viewdidappear:
self.navigationcontroller
non-nil. push responsibility of providinguinavigationcontroller
wrap view controller instance clients of class.alternatively, can embed
uinavigationbar
instance , manage yourself, remember hide possible navigation bar containing navigation controller inviewwillappear:
.
Comments
Post a Comment