我有一个UITableViewController
它成功地列出了从CoreData实体获取的表视图数据。停止导航栏滚动表
我想在顶部有一个导航栏,有几个按钮可以导航,但是当我添加导航栏时,它似乎坐在表格内,在任何列表的下方,因此在滑动时用表格滚动通过表格列表。
因为它是一个UITableViewController
我不能让表格区域变小,所以我不知道如何添加表格外的导航栏。
任何建议如何使修复导航栏就位,以便它不会移动。
下面是使用代码来设置导航栏:
- (void)viewDidLoad
{
UINavigationBar *navBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0,0, 1024,44)];
UINavigationItem *navItem = [[UINavigationItem alloc] initWithTitle:@"Observation details"];
[navBar pushNavigationItem:navItem animated:NO];
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStyleBordered target:self action:@selector(backButton)];
navItem.leftBarButtonItem = backButton;
UIBarButtonItem *detailsButton = [[UIBarButtonItem alloc] initWithTitle:@"Observation Details" style:UIBarButtonItemStyleBordered target:self action:@selector(detailsButton)];
navItem.rightBarButtonItem = detailsButton;
[self.view addSubview:navBar];
}
您使用的是Interface Builder吗? – Groot 2013-05-13 10:26:25
使用故事板?我应该以编程方式做这个吗? – RGriffiths 2013-05-13 10:27:18
你是如何添加导航栏以及它是什么类型的UI项目的?系统提供的标准导航栏不应该滚动。 – 2013-05-13 10:32:05