简体   繁体   中英

Make UIView fix position to the top of UITableViewController

I want to make custom Navigation Bar using UIView but I don't want to embed Navigation Controller. I have tried making UIView but end up the UIView is scrollable. The main thing about Navigation Bar is sticked to the top whether the UITableViewController scrolled or not. How to make the custom Navigation Bar with UIView has fixed position like the original navigation bar. Thanks!

Instead of using a UITableViewController, you should probably use a regular UIViewController and then add a UITableView and your custom UIView as subviews. UITableViewControllers aren't very flexible when it comes to adding subviews. They are meant to take up the entire screen.

For static table views you need to add a UITableViewController as a Container ViewController to another UIViewController. So you will have one main UIViewController that has your custom UIView nav bar and a Container View Controller that holds your UITableViewController.

Simply Create Table Header View. 1.Using Table View Delegate Methods Create Header View Programatically of the Starting Cell.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM