开发者

When and where should I add a view to a UITableView's footer?

I am populating a UITableViewController's UITableView through 开发者_运维百科code only. At the bottom of the table I wish to position a button that scrolls into view as the user scrolls to the bottom of the table.

When in the UITableViewController life cycle should I populate the table footer with a button? viewDidLoad?

p.s. I wish to avoid using section footers in the UITableView.


Yes, viewDidLoad is the correct place. It's not a stone-set rule though - I have change footer view in many different situations, such as after rotation in didRotateFromInterfaceOrientation.

Note that the view will be repositioned to location immediately below the last row, so if you want to provide a margin or centering for your button I suggest adding a plan UIVIew as footer, and then add your button(s) into that UIView.


Yes, put it in viewDidLoad. Here is some sample code.


You can just set the tableFooterView property of a UITableView to your button.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜