Is it wise to use the same xib in the UINavigationController view and the modal view?

I have a view (and a corresponding view controller) in an application for iPhone that allows the user to edit the settings for the application. This view is available through the menu (table view). I am using pushViewController in my subclass of UIViewController to show it. When I do this, it appears as I expect - the navigation bar appears on top of xib, and the empty space that I left there in xib is occupied.

I also sometimes show that settings are displayed as a modal view using presentModalViewController. When I do this, the top of the xib starts at the bottom of the navigation bar, and not below it.

The documentation says that presentModalViewController will resize the view to fit, so I could see that this is the expected behavior. However, for me this is an undesirable behavior.

I can somehow get around this by installing the settings view controller so as not to display the navigation bar, but then a strange empty space appears at the top of the view.

Ideally, I would like to use the same xib in both situations. However, maybe this is not the best practice? How do you guys usually reuse xib?

I thought that maybe I could make the view controller move all the controllers up if it is in modal mode, but I would like something better if it is available.

+3

Source: https://habr.com/ru/post/1717857/


All Articles