Skip to content

Instantly share code, notes, and snippets.

@roothybrid7
Created October 20, 2012 01:29
Show Gist options
  • Save roothybrid7/3921625 to your computer and use it in GitHub Desktop.
Save roothybrid7/3921625 to your computer and use it in GitHub Desktop.
UITableViewを使いたい場合、UITableViewControllerとUIViewControllerどっちを使うか

#UITableViewController vs UIViewController

__Storyboard__や__Interface builder__を使う場合の話

  • UITableViewControllerは、UIViewControllerのサブクラス
  • table viewの扱いに最適化され、追加機能もある

##具体例

__table cell__に__text field__があり、__text field__をタップした時にキーボードが立ち上がる。 その時、UITableViewControllerは自動的にキーボードの後ろに隠れない様にセルをスクロールする。

##制限

  • メインビューがUITableViewでなければいけない(navigation bar__や__toolbar、__tab bar__などを除くと)
  • UITableViewのヘッダとかに、UISearchBarを配置すること等は可能

##UITableViewと並列でViewを置く場合

UITableViewControllerではなく、UIViewControllerを使う

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment