开发者

Add a toolbar to a tableView

I'm using the XCode 4.3 "Master/Detail" template for the iPhone. At the ROOT level, this is a UIToolbarController. I want navigation and toolbars. The navigation is easy--the template already uses the self.navigationItem.leftBarButtonItem (and right) to add buttons, but I can't find a way to add useful toolbar items. I can add a toolbar (see below), but this gets added to the scroll view of the tableview, so scrolls up and down with the table contents--not very useful. The tableView.view has no superview which is where you'd think a tool bar should go. It has no window either! (all these properties are null).

That top navbar must belong to some view which is not scrolled, but what?!! Setting the toolbarHidden property of self.na开发者_如何学GovigationController has no effect (setting the navigationBarHidden to YES does not hide the nav bar either).

Obviously something I don't understand here...

// this toolbar scrolls with the tableview contents!
INavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:self];
nvc.toolbarHidden = NO;
[self.view addSubview:nvc.view];


Just highlight the navigation controller and then look at the attributes. check "Shows Toolbar" to unhide the toolbar that is already there.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜