Navigation gap appears when swipe from large title page to small title page!
相关问题
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
- SwiftUI: UIImage (QRCode) does not load after call
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- Using if let syntax in switch statement
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Enum with associated value conforming to CaseItera
- Swift - hide pickerView after value selected
- Is there a Github markdown language identifier for
The view's layout starts from the bottom of the navigation bar. When transit from large title page to small title page, the navigation bar becomes shorter, then the navigation gap appears.
To resolve this problem, the layout of the controller's view should start from the zero point of the screen, and it's subviews' layout should start from the bottom of the navigation bar to prevent from being covered.
Two properties can effect the layout: translucent and edgesForExtendedLayout. The translucent property should be set to YES, or delete it everywhere(It's default value is YES). The edgesForExtendedLayout property should be set to UIRectEdgeAll, or delete it everywhere(It's default value is UIRectEdgeAll).
For UITableViewController's page, it will automatically adjust to the navigationbar(tableview's adjustedContentInset will change, the premise is set contentInsetAdjustmentBehavior to UIScrollViewContentInsetAdjustmentAutomatic, or delete the setting), any other code should not change.
For UIViewController, the subviews' of the main view should adjust its layout to the bottom of the navigation bar. The example code like,
If the first view (A) of the subviews inherits from UIScrollView, and the large title will change according to the A's scroll. The detail can be found in Shrink large title when scrolling (not UITableViewController) iOS 11 .
If the top most view inherites from UIScrollView, like mainTableView, you can set its layout start from the zero point, and set its contentInset to the bottom of the navigation bar. It looks like an UITableViewController, and the navigation bar changes when mainsTableView scrolling, without any white space. The example code like,
Make sure, you just need to check Translucent selected from the storyboard.
Set in code like this
Outout :