I have a grouped UITableView
and I\'d like to add a UIButton to the very bottom of my UITableView
. I\'m using Storyboard and a UITableViewControlle
Actually, you can add UIButton to stick in bottom (or header) of the view, it doesn't matter if you're using UITableViewController
or UIViewController
For X
and Y
I apply the entire view size, this will allow me to add margin with -
the amount I like. Then, just set size and width.
let myButton: UIButton = UIButton(CGRect(x: self.view.bounds.size.width - 66, y: self.view.bounds.size.height - 66, width: 50, height: 50))
Note
See how the width and height are
66
? Well, you need to add your margin to the height and width of the button. In this case,50 + 16 = 66
. Also, add you background color and other properties, that way your button is visible.
self.navigationController?.view.addSubview(myButton)
I'm sure you can figure out how to do this in Swift 2, 1 or Objective-C.