I have tableview in one viewcontroller. I have one section in that. I want to add button in footer. I have written this code but footer view is not displaying.
-
Same code in swift
func tableView(tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 100.0
}
func tableView(tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
let footerView = UIView(frame:CGRectMake(0,0,320,40))
let loginButton = UIButton(type: .Custom)
loginButton.setTitle("LOGIN", forState: .Normal)
loginButton.addTarget(self, action: "loginAction", forControlEvents: .TouchUpInside)
loginButton.setTitleColor(UIColor.whiteColor(), forState: .Normal)
loginButton.backgroundColor = UIColor.blueColor()
loginButton.frame = CGRectMake(0, 0, 130, 30)
footerView.addSubview(loginButton)
return footerView
}
func loginAction()
{
print("Hello");
}