Search code examples
iosswiftuikittableview

Additional tab, when editing table


There is an additional pane with buttons appears in messages app on iPhone when tapping Edit button. See link, screenshot.

Messages app on iPhone

Is it a default UITableView property? (Probably not)

Is it a UIView, showing over tableView with delegate methods for handling buttons actions?

I searched everywhere with no luck. Can you give me the cue, how I can make the same one myself? My app is written in Swift.


Solution

  • Thanks to all, you were right, it is a UIToolbar, and it is quite easy to use.

    To create toolbar:

    let toolbar = UIToolbar(frame: CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: 50))
        toolbar.barStyle = UIBarStyle.default
        toolbar.items = [
            UIBarButtonItem(title: "Cancel", style: UIBarButtonItemStyle.plain, target: self, action: #selector(cancelAction)),
            UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.flexibleSpace, target: nil, action: nil),
            UIBarButtonItem(title: "Next", style: UIBarButtonItemStyle.plain, target: self, action: #selector(nextAction))]
        toolbar.sizeToFit()
    

    To show it:

    view.addSubview(toolbar)
    

    To remove it:

    toolbar.removeFromSuperView