Create a textfield and send button at the bottom of uitableview like Instagram comment section
<p>I would like to add a textfield and send button that sticks to the bottom of uitableview. I added a footer to the tableview to achieve this, but it seems like the footer is appearing right under the last comment instead of the very bottom of uitableview. I'd also want to move the footer up when the keyboard appears and down when it is dismissed. Below you can see my code for reference. Thanks!</p>

<p><img src="https://i.stack.imgur.com/yAgA5.png" alt="Expected Result i.e. instagram/chat app textfield at bottom"></p>

<p><code>Expected Result</code> </p>

<p><img src="https://i.stack.imgur.com/PhSXR.png" alt="Actual outcome"></p>

<p><code>Actual outcome</code> </p>

<pre><code>override func tableView(tableView: UITableView, viewForFooterInSection section: Int) -&gt; UIView? {
    footer = UIView(frame: CGRectMake(0, 0, 320, 44))
    footer!.backgroundColor = UIColor.lightGrayColor()

    textField = UITextField(frame: CGRectMake(5, 5, 315, 35))
    textField!.borderStyle = UITextBorderStyle.Bezel

    yourSendButton = UIButton(frame: CGRectMake(318,5,62,35))
       // [[UIButton alloc] initWithFrame:CGRectMake(225,5,75,35)];
    yourSendButton!.backgroundColor = UIColor.lightGrayColor()
    yourSendButton!.setTitle("Send", forState: .Normal)
    yourSendButton!.setTitleColor(UIColor.darkGrayColor(), forState: .Normal)
    yourSendButton!.addTarget(self, action: "sendBtnClicked:", forControlEvents: UIControlEvents.TouchUpInside)
    //addTarget:self action:@selector(sendBtnClicked) forControlEvents:UIControlEventTouchUpInside];

    footer!.addSubview(yourSendButton!)
    footer!.addSubview(textField!)

    self.navigationController?.view.addSubview(footer!)

    return footer
}

override func tableView(tableView: UITableView, heightForFooterInSection section: Int) -&gt; CGFloat {
    return 44
}

func sendBtnClicked (sender: UIButton) {
    print("send button pressed")
    print(textField?.text)
}
</code></pre>