{"id":132,"date":"2025-10-04T09:42:35","date_gmt":"2025-10-04T00:42:35","guid":{"rendered":"https:\/\/devserver.kr\/blog\/?p=132"},"modified":"2025-10-04T09:42:35","modified_gmt":"2025-10-04T00:42:35","slug":"ios-uitableview","status":"publish","type":"post","link":"https:\/\/devserver.kr\/blog\/ios\/ios-uitableview\/","title":{"rendered":"iOS UITableView"},"content":{"rendered":"\n<div class=\"wp-block-jetpack-markdown\"><h4>\ud544\uc218 \ud568\uc218 \uba87 \uac1c<\/h4>\n<pre><code class=\"language-swift\">func numberOfSections(in tableView: UITableView) -&gt; Int {\n    return 1\n}\n    \nfunc tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {\n    return 7\n}\n    \nfunc tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {\n    switch indexPath.row {\n    let cell = tableView.dequeueReusableCell(withIdentifier: &quot;SWITCH_CELL&quot;, for: indexPath) as? SwitchTVCell\n    cell!.label?.text = &quot;\ub2e4\ud06c \ud14c\ub9c8&quot;\n    cell!.swOnOff.setOn(true, animated: false)\n    \/*\n    if isLock {\n    cell!.swOnOff.setOn(true, animated: false)\n    }\n    else {\n    cell!.swOnOff.setOn(false, animated: false)\n    }\n    *\/\n    cell!.delegate = self\n    cell!.tag = 1005\n    cell!.selectionStyle = .none\n            \n    return cell!\n}\n    \nfunc tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {\n    switch indexPath.row {\n    case 0:\n        print(&quot;switchCell tapped.&quot;)\n    case 1:\n        print(&quot;switchCell tapped.&quot;)\n    case 2:\n        print(&quot;switchCell tapped.&quot;)\n    case 3:\n        print(&quot;basicCell tapped.&quot;)\n    default:\n        print(&quot;default&quot;)\n    }\n}\n<\/code><\/pre>\n<h4>custom cell<\/h4>\n<p>UIViewController \uc5d0 UITableView \ub97c \uc62c\ub9ac\uace0, \uadf8 \uc704\uc5d0 UITableViewCell \uc744 \uc62c\ub9b0\ub2e4.<\/p>\n<p>Prototype Cells \ub77c\uace0 \ud5e4\ub354\uac00 \uc0dd\uae30\uace0 \ube48 \uc140\uc774 \ud558\ub098 \ucd94\uac00\ub41c\ub2e4.<\/p>\n<p>Table View \uc778\uc2a4\ud399\ud130\uc5d0 \uac00\uc11c<\/p>\n<ul>\n<li>Content : Dynamic Prototypes<\/li>\n<li>Prototype Cells \uac2f\uc218 \uc124\uc815<\/li>\n<\/ul>\n<h4>cell \uc0ac\uc774 \uad6c\ubd84\uc120 \uac10\ucd94\uae30<\/h4>\n<pre><code class=\"language-swift\">tableView.separatorStyle = .none\n<\/code><\/pre>\n<h4>hide empty Cells<\/h4>\n<pre><code class=\"language-swift\">func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -&gt; UIView? {\n    return UIView()\n}\n<\/code><\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4,7],"tags":[],"class_list":["post-132","post","type-post","status-publish","format-standard","hentry","category-ios","category-swift"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/devserver.kr\/blog\/wp-json\/wp\/v2\/posts\/132","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devserver.kr\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devserver.kr\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devserver.kr\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/devserver.kr\/blog\/wp-json\/wp\/v2\/comments?post=132"}],"version-history":[{"count":1,"href":"https:\/\/devserver.kr\/blog\/wp-json\/wp\/v2\/posts\/132\/revisions"}],"predecessor-version":[{"id":133,"href":"https:\/\/devserver.kr\/blog\/wp-json\/wp\/v2\/posts\/132\/revisions\/133"}],"wp:attachment":[{"href":"https:\/\/devserver.kr\/blog\/wp-json\/wp\/v2\/media?parent=132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devserver.kr\/blog\/wp-json\/wp\/v2\/categories?post=132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devserver.kr\/blog\/wp-json\/wp\/v2\/tags?post=132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}