{"id":173,"date":"2016-01-28T11:29:51","date_gmt":"2016-01-28T03:29:51","guid":{"rendered":"http:\/\/www.yusian.com\/blog\/?p=173"},"modified":"2016-07-14T22:51:42","modified_gmt":"2016-07-14T14:51:42","slug":"%e7%ae%80%e5%8d%95%e9%80%92%e5%bd%92%e5%ae%9e%e7%8e%b0%e9%81%8d%e5%8e%86%e5%ad%90%e8%a7%86%e5%9b%be","status":"publish","type":"post","link":"https:\/\/www.yusian.com\/blog\/project\/2016\/01\/28\/112951173.html","title":{"rendered":"\u7b80\u5355\u9012\u5f52\u5b9e\u73b0\u904d\u5386\u5b50\u89c6\u56fe"},"content":{"rendered":"<p>1\u3001\u65b9\u6cd5\u5b9e\u73b0<\/p>\n<pre lang=\"objc\" line=\"1\">\/\/\/ \u904d\u5386\u5b50\u89c6\u56fe\n- (void)subviewWithBlock:(void(^)(UIView *view))aBlock\n{\n????\/\/ \u5982\u679c\u6709\u5b50\u89c6\u56fe\u5219\u8fdb\u5165\u5faa\u73af\n????for (UIView *view in self.subviews) {\n????????\/\/ \u5982\u679c\u5b50\u89c6\u56fe\u4e0d\u5c5e\u4e8eUIView\u5219\u9000\u51fa\u672c\u6b21\u5faa\u73af\n????????if(![view isKindOfClass:[UIView class]]) continue;\n????????\/\/ Block\u4e0d\u4e3a\u7a7a\u5219\u6267\u884cBlock\n????????if(aBlock) aBlock(view);\n????????\/\/ \u901a\u8fc7\u9012\u5f52\u904d\u5386\u5b50\u89c6\u56fe\u7684\u5b50\u89c6\u56fe\n????????[view subviewWithBlock:aBlock];\n????}\n}<\/pre>\n<p>2\u3001\u65b9\u6cd5\u8c03\u7528<\/p>\n<pre lang=\"objc\" line=\"1\">[self subviewWithBlock:^(UIView *view) {\n????\/\/ Code...\n}];<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u65b9\u6cd5\u5b9e\u73b0 \/\/\/ \u904d\u5386\u5b50\u89c6\u56fe &#8211; (void)subviewWithBlock:(void(^)(UIView *view))aBlock { ????\/\/ \u5982\u679c\u6709\u5b50\u89c6\u56fe\u5219\u8fdb\u5165\u5faa\u73af ????for (UIView *view in self.subviews) { ????????\/\/ \u5982\u679c\u5b50\u89c6\u56fe\u4e0d\u5c5e\u4e8eUIView\u5219\u9000\u51fa\u672c\u6b21\u5faa\u73af ????????if(![view isKindOfClass:[UIView class]]) continue; ????????\/\/ Block\u4e0d\u4e3a\u7a7a\u5219\u6267\u884cBlock ????????if(aBlock) aBlock(view); ????????\/\/ \u901a\u8fc7\u9012\u5f52\u904d\u5386\u5b50\u89c6\u56fe\u7684\u5b50\u89c6\u56fe ????????[view subviewWithBlock:aBlock]; ????} } 2\u3001\u65b9\u6cd5\u8c03\u7528 [self subviewWithBlock:^(UIView *view) { ????\/\/ Code&#8230; }];<\/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-173","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\/173","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=173"}],"version-history":[{"count":0,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/173\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/media?parent=173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/categories?post=173"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/tags?post=173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}