{"id":1155,"date":"2017-10-06T11:32:43","date_gmt":"2017-10-06T02:32:43","guid":{"rendered":"http:\/\/blue-bear.jp\/kb\/?p=1155"},"modified":"2018-01-15T22:42:50","modified_gmt":"2018-01-15T13:42:50","slug":"swift-tableviewcontroller%e3%81%ae%e3%83%86%e3%83%b3%e3%83%97%e3%83%ac%e3%83%bc%e3%83%88","status":"publish","type":"post","link":"https:\/\/blue-bear.jp\/kb\/swift-tableviewcontroller%e3%81%ae%e3%83%86%e3%83%b3%e3%83%97%e3%83%ac%e3%83%bc%e3%83%88\/","title":{"rendered":"[swift] tableViewController\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8"},"content":{"rendered":"<p>tableViewController\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u8a18\u8ff0\u3057\u3066\u304a\u304f\u3002<\/p>\n<p>Storyboard\u306bViewController + TableView + TableViewCell\u3092\u914d\u7f6e\u3057\u3066\u304a\u304f\u3053\u3068\u3002<\/p>\n<p>TableViewCell\u306b\u306f&#8221;tableCell&#8221;\u3068\u3044\u3046\u540d\u524d\u3092\u632f\u3063\u3066\u304a\u304f<\/p>\n<pre class=\"lang:default decode:true \">import Foundation\r\nimport UIKit\r\n\r\nclass testTableViewContoller: UIViewController, UITableViewDelegate, UITableViewDataSource{\r\n \r\n @IBOutlet weak var tableView: UITableView!\r\n let array:[String] = [\"swift\",\"Ruby\",\"Rails\",\"PHP\",\"HTML.CSS\",\"JS\",\"Java\"]\r\n \r\n override func viewDidLoad() {\r\n super.viewDidLoad()\r\n \r\n \/\/ Delegate\u306e\u8a2d\u5b9a\r\n tableView.dataSource = self\r\n tableView.delegate = self\r\n \r\n }\r\n \r\n \r\n override func didReceiveMemoryWarning() {\r\n super.didReceiveMemoryWarning()\r\n }\r\n \r\n func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {\r\n \/\/ 1section\u306b\u304a\u3051\u308b\u30bb\u30eb\u306e\u6570\r\n return array.count\r\n }\r\n \r\n \r\n func numberOfSections(in tableView: UITableView) -&gt; Int {\r\n \/\/ section\u306e\u6570\r\n return 1\r\n }\r\n \r\n func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -&gt; CGFloat {\r\n \/\/ \u30bb\u30eb\u306e\u9ad8\u3055\r\n return 50\r\n }\r\n \r\n \r\n func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {\r\n \r\n \/\/ \u30bb\u30eb\u306e\u5185\u5bb9\u8a2d\u5b9a\r\n let cell = tableView.dequeueReusableCell(withIdentifier: \"tableCell\", for: indexPath)\r\n cell.textLabel?.text = array[indexPath.row]\r\n \r\n return cell\r\n \r\n }\r\n \r\n func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {\r\n \r\n \/\/\u9078\u629e\u3055\u308c\u305f\u6642\u306e\u51e6\u7406\r\n \r\n }\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>tableViewController\u306e<\/p>\n","protected":false},"author":1,"featured_media":88,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/posts\/1155"}],"collection":[{"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/comments?post=1155"}],"version-history":[{"count":4,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/posts\/1155\/revisions"}],"predecessor-version":[{"id":1558,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/posts\/1155\/revisions\/1558"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/media\/88"}],"wp:attachment":[{"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/media?parent=1155"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/categories?post=1155"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/tags?post=1155"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}