2012-07-27 70 views
0

我有一个UITableViewController的子类,我想添加一个UINavBar它。这是一个非常类似于本地联系人应用程序的设置,点击“添加联系人”,并在顶部显示带有“取消”和“完成”选项的导航栏的分组表格视图。关键是我需要它来呈现使用垂直过渡(与presentModalViewController有效:动画:是),但我已尝试使用Interface Builder并以编程方式添加它,并且在这两种情况下,按钮都不响应,并且滚动条与tableview,而不是停留在顶部。我的UINavBar不响应触摸,并滚动tableview

由于提前,

HBhargava

+0

发布您的代码将有很大的帮助:

MyTableViewController *table = [MyTableViewController alloc] initWithStyle:UITableViewStyledGrouped]; UINavigationController *nav = [UINavigationController alloc] initWithRootViewController:table]; [self presentModalViewController:nav animated:YES]; 
在您的表视图控制器的viewDidLoad

然后。 – WrightsCS 2012-07-27 18:59:20

回答

1

这听起来像你正在做导航栏表视图的一个子视图,这可以解释为什么导航栏滚动与表视图。

试试这个在操作方法:

UIBarButtonItem *doneButton = [UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(done:)]; 
self.navigationItem.rightBarButtonItem = doneButton;