xcode - How can I add a Toolbar to a UITableViewController

心不动则不痛 提交于 2019-12-11 21:12:22

问题


I have a little problem. I wanna add a Toolbar in the button of my UITableViewController, but it doesn't work. Why?


回答1:


If your UITableViewController is embedded in UINavigationController, the navigation controller comes with a toolbar. You wouldn't need to add your own.

The navigation controller's toolbar is hidden by default. You can enable it by:

  • Checking the Shows toolbar option in the navigation controller Interface Builder attribute inspector pane, or

  • Setting the toolbar visibility in code:

    [self.navigationController setToolbarHidden:NO animated:YES];
    

Enabling the toolbar in Storyboard has the advantage of letting you drag and drop items onto it using Interface Builder. You can also add toolbar items in code, by calling setToolbarItems:



来源:https://stackoverflow.com/questions/30432729/xcode-how-can-i-add-a-toolbar-to-a-uitableviewcontroller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!