Why Does Uiviewcontroller Extend Under Uinavigationbar, While Uitableviewcontroller Doesn'T

Why does UIViewController extend under UINavigationBar, while UITableViewController doesn't?

By default, UITableViewController's views are automatically inset in iOS7 so that they don't start below the navigation bar/status bar. This is controller by the "Adjust scroll view insets" setting on the Attributes Inspector tab of the UITableViewController in Interface Builder, or by the setAutomaticallyAdjustsScrollViewInsets: method of UIViewController.

For a UIViewController's contents, if you don't want its view's contents to extend under the top/bottom bars, you can use the Extend Edges Under Top Bars/Under Bottom Bars settings in Interface Builder. This is accessible via the edgesForExtendedLayout property.

What is the extend edge property in UIViewController for ?

By default, UITableViewController's views are automatically inset in iOS7 so that they don't start below the navigation bar/status bar. This is controller by the "Adjust scroll view insets" setting on the Attributes Inspector tab of the UITableViewController in Interface Builder, or by the setAutomaticallyAdjustsScrollViewInsets: method of UIViewController.

For a UIViewController's contents, if you don't want its view's contents to extend under the top/bottom bars, you can use the Extend Edges Under Top Bars/Under Bottom Bars settings in Interface Builder. This is accessible via the edgesForExtendedLayout property.

Reference: Why does UIViewController extend under UINavigationBar, while UITableViewController doesn't?

How iOS UITableView under NavigationBar?

I solved task with this simple code:

table.ScrollIndicatorInsets = new UIEdgeInsets(64, 0, 0, 0);

UIViewController: White space between UITableView and UIToolbar

I've found a workaround for that problem:

override func viewDidLoad() {
super.viewDidLoad()
tableView.contentInset = UIEdgeInsetsMake(0, 0, -50, 0)
tableView.scrollIndicatorInsets = tableView.contentInset
}

Height of UINavigationBar in UITableView doesn't change

Please set the size of image in Navigation Bar less than 49 pt. Please refer Apple Guidelines - Navigation Bar

Add Navigation Bar with title without Navigation controller on UITableViewController from Storyboard

In Storyboard, you can't add any other view at the same level of the TableView in TableViewController, so adding UINavigationBar won't work here.

You can show navigation bar using UINavigationController:

  1. In Storyboard first, select your Table View Controller.

  2. Then Open Editor menu, and select Embed In option, and choose Navigation Controller. You will get your navigation controller pointing to your tableview controller.

Can't make UITableView appear under translucent navigation bar

set

self.automaticallyAdjustsScrollViewInsets = NO

in viewDidLoad and then check

iOS 11 large-title navigation bar not collapsing

Good news! I've just figured out that if I set "Large Titles" to "Never" on the storyboard, and then set it via code, then it works:

- (void)viewDidLoad {
[super viewDidLoad];
self.navigationItem.largeTitleDisplayMode = UINavigationItemLargeTitleDisplayModeAutomatic;
}

Seems like Apple forgot to handle the case when the navigation item has its largeTitleDisplayMode set via the Interface Builder.

So until they fix this issue, leave "Large Titles" as "Never" on storyboards, and set them via code in viewDidLoad.

You just need to do that to the first view controller. Subsequent view controllers honor the value in storyboard.

iOS 11 large title navigation bar snaps instead of smooth transition

I faced same issue - I had UIViewController embedded in UINavigationController, the UIViewController had tableview with leading, trailing, top, bottom constraints to safe area. The whole tableview behaved jumpy / snappy. The trick was to change top constraint of tableview to superview.



Related Topics



Leave a reply



Submit