Add button overlay on UITableViewController with use static cells

Дмитрий Деникаев

I try to add button overlay on UITableViewController with static cells. But i get this result, button is working, but i not see result of search:

enter image description here

I'm trying to get this result:

enter image description here

I want to button was always at the bottom regardless of scrolling up or down.

In my code i use framework InstantSearch:

import UIKit
import InstantSearch
import WARangeSlider

class SearchTableViewController: UITableViewController {

    @IBOutlet weak var resultButton: StatsButtonWidget!

    override func viewDidLoad() {
        super.viewDidLoad()

        resultButton.frame = CGRect(x: 0, y: 0, width: 150, height: 60)
        navigationController?.view.addSubview(resultButton)

        InstantSearch.shared.registerAllWidgets(in: self.view)

        LayoutHelpers.setupResultButton(button: resultButton)
        resultButton.addTarget(self, action: #selector(resultButtonClicked), for: .touchUpInside)

    }
}

How can i add button overlay on bottom in UITableViewController? Me need use only UITableViewController, not UIViewController with TableView.

Willjay

You can just add an view at the bottom of your tableview.

override func viewDidLoad() {
    super.viewDidLoad()
    addResultButtonView()
}

private func addResultButtonView() {
    let resultButton = UIButton()

    resultButton.backgroundColor = .red
    resultButton.setTitle("Hello", for: .normal)
    tableView.addSubview(resultButton)

    // set position
    resultButton.translatesAutoresizingMaskIntoConstraints = false
    resultButton.leftAnchor.constraint(equalTo: tableView.safeAreaLayoutGuide.leftAnchor).isActive = true
    resultButton.rightAnchor.constraint(equalTo: tableView.safeAreaLayoutGuide.rightAnchor).isActive = true
    resultButton.bottomAnchor.constraint(equalTo: tableView.safeAreaLayoutGuide.bottomAnchor).isActive = true
    resultButton.widthAnchor.constraint(equalTo: tableView.safeAreaLayoutGuide.widthAnchor).isActive = true
    resultButton.heightAnchor.constraint(equalToConstant: 50).isActive = true // specify the height of the view
}

enter image description here

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Static Cells in UITableViewController error

From Dev

iOS - static cells not appearing in a subclass of UITableViewController

From Dev

iOS - Using a UISearchDisplayController on a UITableViewController with static cells

From Dev

iOS - static cells not appearing in a subclass of UITableViewController

From Dev

add table cells to class that inhiret UITableViewController

From Dev

Use a button as a static label

From Dev

How to add button overLay in Video Tag

From Dev

How to add button overLay in Video Tag

From Dev

Cells Do Not Appear in UITableViewController

From Dev

Can I use one custom created UIViewController to populating cells text value of parent UITableViewController?

From Dev

How to change button title from table static cells?

From Dev

NSUserDefaults to add row in a UITableViewController

From Dev

Add UIView to UITableViewController with Storyboards

From Dev

Use Adaptive Layout programmatically to resize static cells height for hCompact

From Dev

How to use static and dynamic text inside a Button

From Dev

use static button to check the values and display on screen

From Dev

static background and video overlay

From Dev

Use setHighlighted in the UITableViewController

From Dev

Make UITableViewController cells not disappear when navigating away

From Dev

Nested UITableViewController does not show any cells

From Dev

UITableViewController with custom data source not showing cells

From Dev

UITableViewController not loading custom cells using xib file

From Dev

photoswipe overlay button on Image

From Dev

Add footer to UITableViewController using storyboard

From Dev

How to add an adbannerview in UITableViewController in Swift?

From Dev

Add footer to UITableViewController using storyboard

From Dev

How to add cell dynamically in uitableviewcontroller?

From Dev

Use Excel SUMIF to add cells with custom number formatted dollar value

From Dev

How to add a button to the bottom of a static table view in storyboard

Related Related

  1. 1

    Static Cells in UITableViewController error

  2. 2

    iOS - static cells not appearing in a subclass of UITableViewController

  3. 3

    iOS - Using a UISearchDisplayController on a UITableViewController with static cells

  4. 4

    iOS - static cells not appearing in a subclass of UITableViewController

  5. 5

    add table cells to class that inhiret UITableViewController

  6. 6

    Use a button as a static label

  7. 7

    How to add button overLay in Video Tag

  8. 8

    How to add button overLay in Video Tag

  9. 9

    Cells Do Not Appear in UITableViewController

  10. 10

    Can I use one custom created UIViewController to populating cells text value of parent UITableViewController?

  11. 11

    How to change button title from table static cells?

  12. 12

    NSUserDefaults to add row in a UITableViewController

  13. 13

    Add UIView to UITableViewController with Storyboards

  14. 14

    Use Adaptive Layout programmatically to resize static cells height for hCompact

  15. 15

    How to use static and dynamic text inside a Button

  16. 16

    use static button to check the values and display on screen

  17. 17

    static background and video overlay

  18. 18

    Use setHighlighted in the UITableViewController

  19. 19

    Make UITableViewController cells not disappear when navigating away

  20. 20

    Nested UITableViewController does not show any cells

  21. 21

    UITableViewController with custom data source not showing cells

  22. 22

    UITableViewController not loading custom cells using xib file

  23. 23

    photoswipe overlay button on Image

  24. 24

    Add footer to UITableViewController using storyboard

  25. 25

    How to add an adbannerview in UITableViewController in Swift?

  26. 26

    Add footer to UITableViewController using storyboard

  27. 27

    How to add cell dynamically in uitableviewcontroller?

  28. 28

    Use Excel SUMIF to add cells with custom number formatted dollar value

  29. 29

    How to add a button to the bottom of a static table view in storyboard

HotTag

Archive