0

我在 UINavigationController 中手动嵌入了一个 uitableviewcontroller,如下所示。

navigationController = [[UINavigationController alloc] init];
jabBookModelTableViewController *vc = [[jabBookModelTableViewController alloc]init];
vc.booksPassed = booksToPass;
vc.user = user;
navigationController.viewControllers=[NSArray arrayWithObject:vc];
vc.navigationController = navigationController;
[self presentModalViewController:navigationController animated:YES];

我的问题是在我的 UITableViewController 类中我创建了一个条形按钮:

UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithTitle:@"Save Books"
                                                                  style:UIBarButtonItemStylePlain
                                                                 target:self
                                                                 action:@selector(saveBooksAction)];
self.navigationItem.leftBarButtonItem = anotherButton;

如果我在表中加载 30 行,然后向下滚动条形按钮向上滚动,那么用户必须滚动到顶部才能到达按钮。

如何让 UITableViewController 子类滚动,但 UINavigationController 留在一个地方?

我应该以某种方式使用 UIScrollView 并将我的 UITableViewController 子类放在滚动视图中吗?

更新:

我删除了为之创建的属性,navigationController但出现此错误:

jabFirstViewController.m:192:33: Assignment to readonly property
4

0 回答 0