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:

  1. i fall asserting viewdidappear: self.navigationcontroller non-nil. push responsibility of providing uinavigationcontroller wrap view controller instance clients of class.

  2. alternatively, can embed uinavigationbar instance , manage yourself, remember hide possible navigation bar containing navigation controller in viewwillappear:.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -