ios - Issue with finding the height of the main UIView between a Navigation Controller and Tab Bar -
i had issue of trying find displayed area of view under opaque tab bar , opaque navigation bar. frame evidently closer size of screen (likely includes tab , nav bar) visible , views being hidden.
i know if there official way of finding view size , if there way think programmatically, except maybe subtract tab bar , nav heights (and ruin app in future change apple). apple's own autolayout works fine when pinning bottom of uiview (ie. not go under tab view).
just screen size, , subtract known navigation bars , status bars.
+ (cgfloat) estimateviewheightvertical: (uiviewcontroller*)viewcontroller { cgrect screen_size = [[uiscreen mainscreen] bounds]; cgfloat screen_height = screen_size.size.height; cgfloat status_bar_height = [uiapplication sharedapplication].statusbarframe.size.height; cgfloat tab_bar_controller_height = 0; cgfloat nav_bar_controller_height = 0; if (viewcontroller.tabbarcontroller) { tab_bar_controller_height = viewcontroller.tabbarcontroller.tabbar.frame.size.height; } if (viewcontroller.navigationcontroller) { nav_bar_controller_height = viewcontroller.navigationcontroller.navigationbar.frame.size.height; } return screen_height - status_bar_height - nav_bar_controller_height - tab_bar_controller_height; }
Comments
Post a Comment