{"id":860,"date":"2017-03-02T16:58:49","date_gmt":"2017-03-02T08:58:49","guid":{"rendered":"http:\/\/www.yusian.com\/blog\/?p=860"},"modified":"2017-03-02T16:58:49","modified_gmt":"2017-03-02T08:58:49","slug":"%e9%95%bf%e6%8c%89%e6%89%8b%e5%8a%bf%e6%89%a7%e8%a1%8c%e4%b8%a4%e6%ac%a1%e8%a7%a3%e5%86%b3%e5%8a%9e%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.yusian.com\/blog\/analysis\/2017\/03\/02\/165849860.html","title":{"rendered":"\u957f\u6309\u624b\u52bf\u6267\u884c\u4e24\u6b21\u89e3\u51b3\u529e\u6cd5"},"content":{"rendered":"<p>1\u3001\u95ee\u9898\u63cf\u8ff0\uff1a<br \/>\nUILongPressGestureRecognizer\u4e3a\u957f\u6309\u624b\u52bf\u7c7b\uff0c \u4e0e\u5355\u51fb\u53cc\u51fb\u626b\u52a8\u7b49\u624b\u52bf\u7c7b\u4f3c\u5747\u7ee7\u627f\u81eaUIGestureRecognizer\uff0c\u4f46UILongPressGestureRecognizer\u5728\u7ed1\u5b9aView\u89e6\u53d1\u540e\uff0c\u76f8\u5bf9\u5e94\u7684\u65b9\u6cd5\u4f1a\u6267\u884c\u4e24\u6b21\uff1f\uff01<\/p>\n<p>2\u3001\u4ee3\u7406\u5b9e\u73b0(\u5173\u952e\u4ee3\u7801)<\/p>\n<pre lang=\"objc\" line=\"1\">\nUIView *view = [UIView alloc] init];\nUILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longTapAction:)];\n[view addGestureRecognizer:longPress];\n\n- (void)longTapAction:(UILongPressGestureRecognizer *)longPress {\n    if (longPress.state == UIGestureRecognizerStateBegan) {\n        NSLog(@\"long pressTap state :begin\");\n    }else {\n        NSLog(@\"long pressTap state :end\");\n    }\n}\n<\/pre>\n<p>3\u3001\u539f\u56e0\u5206\u6790<br \/>\n\u4ece\u8f93\u51fa\u7684\u6253\u5370\u6765\u770b\uff0c\u786e\u5b9e\u4f1a\u8c03\u7528\u4e24\u6b21\uff0c\u4e00\u6b21\u4e3a\u957f\u6309\u5f00\u59cb\u540e\u6548\u65f6\uff0c\u4e00\u6b21\u4e3a\u957f\u6309\u4e8b\u4ef6\u7ed3\u675f\u65f6\u8c03\u7528\uff0c\u4e24\u6b21\uff01\u5982\u679c\u53ea\u8981\u4e00\u6b21\uff0c\u53d6\u5176\u4e2d\u4e00\u6b21\u6267\u884c\u4e8b\u4ef6\u5373\u53ef\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u95ee\u9898\u63cf\u8ff0\uff1a UILongPressGestureRecognizer\u4e3a\u957f\u6309\u624b\u52bf\u7c7b\uff0c \u4e0e\u5355\u51fb\u53cc\u51fb\u626b\u52a8\u7b49\u624b\u52bf\u7c7b\u4f3c\u5747\u7ee7\u627f\u81eaUIGestureRecognizer\uff0c\u4f46UILongPressGestureRecognizer\u5728\u7ed1\u5b9aView\u89e6\u53d1\u540e\uff0c\u76f8\u5bf9\u5e94\u7684\u65b9\u6cd5\u4f1a\u6267\u884c\u4e24\u6b21\uff1f\uff01 2\u3001\u4ee3\u7406\u5b9e\u73b0(\u5173\u952e\u4ee3\u7801) UIView *view = [UIView alloc] init]; UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longTapAction:)]; [view addGestureRecognizer:longPress]; &#8211; (void)longTapAction:(UILongPressGestureRecognizer *)longPress { if (longPress.state == UIGestureRecognizerStateBegan) { NSLog(@&#8221;long pressTap state :begin&#8221;); }else { NSLog(@&#8221;long pressTap state :end&#8221;); } } 3\u3001\u539f\u56e0\u5206\u6790 \u4ece\u8f93\u51fa\u7684\u6253\u5370\u6765\u770b\uff0c\u786e\u5b9e\u4f1a\u8c03\u7528\u4e24\u6b21\uff0c\u4e00\u6b21\u4e3a\u957f\u6309\u5f00\u59cb\u540e\u6548\u65f6\uff0c\u4e00\u6b21\u4e3a\u957f\u6309\u4e8b\u4ef6\u7ed3\u675f\u65f6\u8c03\u7528\uff0c\u4e24\u6b21\uff01\u5982\u679c\u53ea\u8981\u4e00\u6b21\uff0c\u53d6\u5176\u4e2d\u4e00\u6b21\u6267\u884c\u4e8b\u4ef6\u5373\u53ef\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[20],"class_list":["post-860","post","type-post","status-publish","format-standard","hentry","category-analysis","tag-basics"],"_links":{"self":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/860","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=860"}],"version-history":[{"count":0,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/860\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/media?parent=860"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/categories?post=860"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/tags?post=860"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}