What is the simplest way to add UIToolBar to UITableViewController? I'm depending on edit functionality, so I can't change UITableViewController to UIViewController easily.
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- how do you prevent page scroll in textarea on mobi
- Custom UITableview cell accessibility not working
相关文章
- UITableView dragging distance with UIRefreshContro
- Could I create “Call” button in HTML 5 IPhone appl
- Xcode: Is there a way to change line spacing (UI L
- Unable to process app at this time due to a genera
- Popover segue to static cell UITableView causes co
- How do you detect key up / key down events from a
- “Storyboard.storyboard” could not be opened
- TransitionFromView removes previous view
In order to make PeyloW's recipe to work, I needed to add the following additional line of code:
Hope that helps...
No problem at all,
UITableViewController
is a subclass ofUIViewController
. And it so happens that in iPhone OS 3.0 anyUIViewController
(and subclasses) can work in conjunction with aUINavigationController
to provide a context aware toolbar.In order for this to work you must:
UINavigationController
to contain all your view controllers that needs a toolbar.toolbarsItems
property of the view controller that wants a toolbar.This is almost as easy as as setting the view controller's title, and should be done the same way. Most probably by overriding the
initWithNibName:bundle:
initializer. As an example:You can also use
setToolbarItems:animated:
instead of assigning to thetoolbarItems
property, to add and remove toolbar items in an animated fashion on the fly.And in Swift 3: