{"id":320,"date":"2015-06-23T10:32:08","date_gmt":"2015-06-23T02:32:08","guid":{"rendered":"http:\/\/www.yusian.com\/blog\/?p=320"},"modified":"2016-07-14T22:52:17","modified_gmt":"2016-07-14T14:52:17","slug":"uitableview-group%e6%a8%a1%e5%bc%8f%e9%a1%b6%e9%83%a8%e7%a9%ba%e7%99%bd","status":"publish","type":"post","link":"https:\/\/www.yusian.com\/blog\/project\/2015\/06\/23\/103208320.html","title":{"rendered":"Uitableview Group\u6a21\u5f0f\u9876\u90e8\u7a7a\u767d"},"content":{"rendered":"<p>1\u3001\u770b\u56fe\u8bf4\u8bdd\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-321\" src=\"http:\/\/www.yusian.com\/blog\/wp-content\/uploads\/2016\/07\/iOS-Simulator-Screen-Shot-2015\u5e746\u670823\u65e5-\u4e0a\u534810.21.15.png\" alt=\"iOS-Simulator-Screen-Shot-2015\u5e746\u670823\u65e5-\u4e0a\u534810.21.15\" width=\"320\" height=\"223\" \/><\/p>\n<p><strong>2\u3001\u5728plain\u6a21\u5f0f\u4e0b\u662f\u770b\u4e0d\u7c7b\u4f3c\u4e1c\u897f\u7684\uff0c\u6709\u51e0\u79cd\u65b9\u5f0f\u53ef\u4ee5\u53bb\u6389\u8be5\u7a7a\u767d\uff1a<\/strong><\/p>\n<p>2.1\u3001\u901a\u8fc7\u8bbe\u7f6e<span style=\"font-family: Arial;\">sectionHeaderHeight<\/span>\u5c5e\u6027\u6d88\u9664<br \/>\n<span style=\"font-family: Arial;\"><span style=\"color: #ff0000;\">self.tableView.sectionHeaderHeight = 0;<\/span><\/span><br \/>\n\u8fd9\u79cd\u65b9\u5f0f\u4e0d\u5b8c\u5168\u597d\u7528\uff0c\u6709\u65f6\u5019\u4e0d\u80fd\u5b8c\u5168\u6d88\u9664\uff0c\u518d\u5f80\u4e0b\u8d70\u3002<\/p>\n<p>2.2\u3001\u901a\u8fc7<span style=\"font-family: Arial;\">tableView<\/span>\u7684<span style=\"font-family: Arial;\">contentInset<\/span>\u5c5e\u6027\u5c06\u89c6\u56fe\u4e0a\u79fb\uff0c\u5177\u4f53\u6570\u503c\u6162\u6162\u8c03\u54af<br \/>\n<span style=\"font-family: Arial;\"><span style=\"color: #ff0000;\">self.tableView.contentInset = UIEdgeInsetsMake(-30, 0, 0, 0);<\/span><\/span><\/p>\n<p>2.3\u3001\u4e0a\u8ff0\u8fd9\u79cd\u65b9\u5f0f\u4e00\u822c\u662f\u53ef\u7528\u7684\uff0c\u4f46\u5982\u679c\u5e26\u4e0b\u62c9\u5237\u65b0\u63a7\u4ef6\u7684\u8bdd\uff0c\u8bbe\u7f6e<span style=\"font-family: Arial;\">contenetInset<\/span>\u5c5e\u6027\u53ef\u80fd\u4f1a\u5bf9\u5237\u65b0\u63a7\u4ef6\u9020\u6210\u5f71\u54cd\uff0c\u522b\u6025\uff0c\u8fd8\u6709\u65b9\u6cd5\uff1a<br \/>\n\u8bbe\u7f6e<span style=\"font-family: Arial;\">tableViewHeader<\/span>\uff0c\u8bbe\u7f6e\u4e00\u4e2a\u8868\u5934\u89c6\u56fe\u5373\u53ef\u6d88\u9664\uff0c\u4f46<span style=\"font-family: Arial;\">tableViewHeader<\/span>\u5982\u679c\u8bbe\u7f6e\u4e3anil\uff0c\u4ed6\u662f\u4e0d\u4f1a\u751f\u6548\u7684\u3002<br \/>\n\u8bbe\u7f6e\u4e00\u4e2a\u9ad8\u5ea6\u4e3a0\u7684\u7a7a\u767d<span style=\"font-family: Arial;\">view<\/span>\u5373\u53ef\u89e3\u51b3\uff0c\u6216\u8005\u8bbe\u7f6e\u9ad8\u5ea6\u4e3a0.5\u7070\u8272<span style=\"font-family: Arial;\">view<\/span>\uff0c\u8fd9\u6837\u8fd8\u53ef\u4ee5\u7f8e\u5316\u4e00\u4e0b\uff0c\u56e0\u4e3a\u770b\u8d77\u6765\u5c31\u662f\u9876\u90e8\u6709\u6761\u7ebf\u3002<\/p>\n<p><span style=\"font-family: Arial;\"><span style=\"color: #ff0000;\">? ? UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 0.5)];<br \/>\n[line setBackgroundColor:[UIColor colorWithWhite:0.8 alpha:0.5]];<br \/>\nself.tableView.tableHeaderView = line;<\/span><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u770b\u56fe\u8bf4\u8bdd\uff1a 2\u3001\u5728plain\u6a21\u5f0f\u4e0b\u662f\u770b\u4e0d\u7c7b\u4f3c\u4e1c\u897f\u7684\uff0c\u6709\u51e0\u79cd\u65b9\u5f0f\u53ef\u4ee5\u53bb\u6389\u8be5\u7a7a\u767d\uff1a 2.1\u3001\u901a\u8fc7\u8bbe\u7f6esectionHeaderHeight\u5c5e\u6027\u6d88\u9664 self.tableView.sectionHeaderHeight = 0; \u8fd9\u79cd\u65b9\u5f0f\u4e0d\u5b8c\u5168\u597d\u7528\uff0c\u6709\u65f6\u5019\u4e0d\u80fd\u5b8c\u5168\u6d88\u9664\uff0c\u518d\u5f80\u4e0b\u8d70\u3002 2.2\u3001\u901a\u8fc7tableView\u7684contentInset\u5c5e\u6027\u5c06\u89c6\u56fe\u4e0a\u79fb\uff0c\u5177\u4f53\u6570\u503c\u6162\u6162\u8c03\u54af self.tableView.contentInset = UIEdgeInsetsMake(-30, 0, 0, 0); 2.3\u3001\u4e0a\u8ff0\u8fd9\u79cd\u65b9\u5f0f\u4e00\u822c\u662f\u53ef\u7528\u7684\uff0c\u4f46\u5982\u679c\u5e26\u4e0b\u62c9\u5237\u65b0\u63a7\u4ef6\u7684\u8bdd\uff0c\u8bbe\u7f6econtenetInset\u5c5e\u6027\u53ef\u80fd\u4f1a\u5bf9\u5237\u65b0\u63a7\u4ef6\u9020\u6210\u5f71\u54cd\uff0c\u522b\u6025\uff0c\u8fd8\u6709\u65b9\u6cd5\uff1a \u8bbe\u7f6etableViewHeader\uff0c\u8bbe\u7f6e\u4e00\u4e2a\u8868\u5934\u89c6\u56fe\u5373\u53ef\u6d88\u9664\uff0c\u4f46tableViewHeader\u5982\u679c\u8bbe\u7f6e\u4e3anil\uff0c\u4ed6\u662f\u4e0d\u4f1a\u751f\u6548\u7684\u3002 \u8bbe\u7f6e\u4e00\u4e2a\u9ad8\u5ea6\u4e3a0\u7684\u7a7a\u767dview\u5373\u53ef\u89e3\u51b3\uff0c\u6216\u8005\u8bbe\u7f6e\u9ad8\u5ea6\u4e3a0.5\u7070\u8272view\uff0c\u8fd9\u6837\u8fd8\u53ef\u4ee5\u7f8e\u5316\u4e00\u4e0b\uff0c\u56e0\u4e3a\u770b\u8d77\u6765\u5c31\u662f\u9876\u90e8\u6709\u6761\u7ebf\u3002 ? ? UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 0.5)]; [line setBackgroundColor:[UIColor colorWithWhite:0.8 alpha:0.5]]; self.tableView.tableHeaderView = line;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[17],"class_list":["post-320","post","type-post","status-publish","format-standard","hentry","category-project","tag-skill"],"_links":{"self":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/320","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/comments?post=320"}],"version-history":[{"count":0,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/320\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/media?parent=320"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/categories?post=320"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/tags?post=320"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}