{"id":293714,"date":"2019-08-22T09:02:28","date_gmt":"2019-08-22T09:02:28","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=293714"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=293714","title":{"rendered":"iOS Responder Chain \u0438\u043b\u0438 \u0427\u0442\u043e \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u044e\u0442 \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/i-\/tl\/sa\/i-tlsagkacd2zdsmpd70er1tv4a.png\" alt=\"image\"><\/p>\n<p>  <\/p>\n<blockquote><p><em>\u041a\u0430\u043a\u0430\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u043f\u0435\u0440\u0432\u044b\u043c \u0438 \u0432\u0442\u043e\u0440\u044b\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c?<\/em><\/p>\n<p>  <em>\u0417\u0430 \u0447\u0442\u043e \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0442\u0430\u0440\u0433\u0435\u0442?<\/em><\/p>\n<p>  <em>\u0412 \u043a\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043a\u043d\u043e\u043f\u043a\u0438?<\/em><\/p><\/blockquote>\n<p>  <\/p>\n<h1 id=\"tldr\">TL;DR<\/h1>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u043d\u0430\u0448 \u043c\u0435\u0442\u043e\u0434 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043e\u0431\u043e\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445.<\/p>\n<p>  <\/p>\n<p>\u0422\u043e\u043b\u044c\u043a\u043e \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 <em>UIKit<\/em> \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u0432 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u043e\u043c \u0442\u0430\u0440\u0433\u0435\u0442\u0435(\u0443 \u043d\u0430\u0441 \u044d\u0442\u043e <code>ViewController<\/code>). \u0411\u0443\u0434\u0435\u0442 \u043a\u0440\u0430\u0448, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f iOS Responder Chain, <code>UIKit<\/code> \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043a\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u0433\u043e \u0431\u043b\u0438\u0436\u043d\u0435\u0433\u043e <code>UIResponder<\/code>-a \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434. \u041a\u0440\u0430\u0448\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 \u043d\u0430\u0448 \u043c\u0435\u0442\u043e\u0434 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d.<\/p>\n<p>  <\/p>\n<p><code>UIViewController, UIView, UIApplication<\/code> \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0442 \u043e\u0442 <code>UIResponder<\/code>.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h1 id=\"ios-responder-chain-i-chto-pod-kapotom\">iOS Responder Chain \u0438 \u0447\u0442\u043e \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c<\/h1>\n<p>  <\/p>\n<p>\u0412\u0441\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c iOS Responder Chain \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f <code>UIKit<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u043e \u0441\u0432\u044f\u0437\u043d\u044b\u043c \u0441\u043f\u0438\u0441\u043a\u043e\u043c <code>UIResponder<\/code>-\u043e\u0432. \u042d\u0442\u043e\u0442 \u0441\u043f\u0438\u0441\u043e\u043a <code>UIKit<\/code> \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0438\u0437 first responder(\u043f\u0435\u0440\u0432\u044b\u0439 <code>UIResponder<\/code> \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043b \u0441\u043e\u0431\u044b\u0442\u0438\u0435, \u0443 \u043d\u0430\u0441 \u044d\u0442\u043e <code>UIButton(UIView)<\/code> \u0438 \u0435\u0433\u043e <code>subviews<\/code>.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/yr\/t9\/yg\/yrt9yg8suuum84wzfkjt5mh_3ri.png\" alt=\"image\"><\/p>\n<p>  <\/p>\n<p>UIKit \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 \u0441\u043f\u0438\u0441\u043e\u043a <code>UIResponder<\/code>-\u043e\u0432 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>canPerformAction<\/code> \u043d\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043d\u0430\u0448\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. <\/p>\n<p>  <\/p>\n<pre><code class=\"swift\">open func canPerformAction(_ action: Selector, withSender sender: Any?) -&gt; Bool<\/code><\/pre>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439 <code>UIResponder<\/code> \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c,<br \/>  <code>UIKit<\/code> \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e \u043f\u043e\u0441\u044b\u043b\u0430\u0435\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 <code>UIResponder<\/code>-\u0443 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <code>target<\/code> \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e <code>UIResponder<\/code>-\u0430.<\/p>\n<p>  <\/p>\n<pre><code class=\"swift\">open func target(forAction action: Selector, withSender sender: Any?) -&gt; Any?<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442\u0441\u044f \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043a\u0442\u043e-\u0442\u043e \u0438\u0437 <code>UIResponder<\/code>-\u043e\u0432 \u0441\u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0430\u0448\u0438\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0438\u043b\u0438 \u043c\u0430\u0441\u0441\u0438\u0432 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u0441\u044f \u0438 \u044d\u0442\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u0440\u043e\u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e\u0441\u044c <code>UIViewController<\/code>-\u043e\u043c, \u043d\u043e <code>UIKit<\/code> \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043b \u0437\u0430\u043f\u0440\u043e\u0441 \u043a <code>UIView<\/code> \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u0431\u044b\u043b first responder. \u0423 \u043d\u0435\u0433\u043e \u043d\u0435 \u0431\u044b\u043b\u043e \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 <code>UIKit<\/code> \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u0438\u043b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e <code>UIResponder<\/code>-\u0430 \u0432 \u0441\u0432\u044f\u0437\u043d\u043e\u043c \u0441\u043f\u0438\u0441\u043a\u0435 \u043a\u0435\u043c \u044f\u0432\u043b\u044f\u043b\u0441\u044f <code>UIViewController<\/code> \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u044b\u043b \u043d\u0443\u0436\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 <code>iOS Responder Chain<\/code> \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 <code>subviews<\/code>, \u043d\u043e \u0435\u0433\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c. \u041c\u043e\u0436\u043d\u043e \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c <code>UIResponder (becomeFirstResponder)<\/code> \u0441\u0442\u0430\u0442\u044c<br \/>  \u043f\u0435\u0440\u0432\u044b\u043c <code>UIResponder<\/code> \u0438 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0435\u0433\u043e \u043a \u0441\u0442\u0430\u0440\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>resignFirstResponder<\/code>. \u042d\u0442\u043e \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441 <code>UITextField<\/code> \u0434\u043b\u044f \u043f\u043e\u043a\u0430\u0437\u0430 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d\u0430, \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0433\u0434\u0430 <code>UITextField<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>first responder<\/code>-\u043e\u043c.<\/p>\n<p>  <\/p>\n<h1 id=\"ios-responder-chain-i-uievent\">iOS Responder Chain \u0438 UIEvent<\/h1>\n<p>  <\/p>\n<p>The Responder Chain \u0442\u0430\u043a \u0436\u0435 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0440\u0438 \u043a\u0430\u0441\u0430\u043d\u0438\u044f\u0445 \u044d\u043a\u0440\u0430\u043d\u0430, \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f\u0445, \u043d\u0430\u0436\u0430\u0442\u0438\u044f\u0445. \u041a\u043e\u0433\u0434\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044f(touch, motion, remote-control, press), \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f <code>UIEvent<\/code> \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <code>UIApplication.shared.sendEvent()<\/code> \u043a <code>UIWindow<\/code>. \u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f <code>UIWindow<\/code> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <code>hitTest:withEvent<\/code> \u043a \u043a\u0430\u043a\u043e\u043c\u0443 <code>UIResponder<\/code> \u0434\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u0438 \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0435\u0433\u043e <code>first responder<\/code>-\u043e\u043c. \u0414\u0430\u043b\u044c\u0448\u0435 \u0438\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0441\u0432\u044f\u0437\u043d\u044b\u043c \u0441\u043f\u0438\u0441\u043a\u043e\u043c <code>UIResponder<\/code>-\u043e\u0432 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u0432\u044b\u0448\u0435.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e \u0431\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c\u0438 <code>UIEvent<\/code>-\u0430\u043c\u0438, \u0441\u0430\u0431\u043a\u043b\u0430\u0441\u0441\u044b <code>UIResponder (UIViewController, UIView, UIApplication)<\/code> \u043c\u043e\u0433\u0443\u0442 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"swift\">open func touchesBegan(_ touches: Set&lt;UITouch&gt;, with event: UIEvent?) open func touchesMoved(_ touches: Set&lt;UITouch&gt;, with event: UIEvent?) open func touchesEnded(_ touches: Set&lt;UITouch&gt;, with event: UIEvent?) open func touchesCancelled(_ touches: Set&lt;UITouch&gt;, with event: UIEvent?) open func pressesBegan(_ presses: Set&lt;UIPress&gt;, with event: UIPressesEvent?) open func pressesChanged(_ presses: Set&lt;UIPress&gt;, with event: UIPressesEvent?) open func pressesEnded(_ presses: Set&lt;UIPress&gt;, with event: UIPressesEvent?) open func pressesCancelled(_ presses: Set&lt;UIPress&gt;, with event: UIPressesEvent?) open func motionBegan(_ motion: UIEvent.EventSubtype, with event: UIEvent?) open func motionEnded(_ motion: UIEvent.EventSubtype, with event: UIEvent?) open func motionCancelled(_ motion: UIEvent.EventSubtype, with event: UIEvent?) open func remoteControlReceived(with event: UIEvent?)<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0435 \u0441\u043c\u043e\u0442\u0440\u044f \u0447\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c <code>sendEvent<\/code> \u0432 \u0440\u0443\u0447\u043d\u0443\u044e \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442, <code>UIResponder<\/code> \u043d\u0435 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u0440\u0430\u0431\u043e\u0442\u043e\u0439 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u043d\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u043c \u0432\u044b\u0437\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c <code>first responeder<\/code>-\u043e\u043c \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u0440\u0435\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u0432\u0430\u0448\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435.<\/p>\n<p>  <\/p>\n<h1 id=\"chem-eto-polezno-gde-ispolzovat\">\u0427\u0435\u043c \u044d\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e, \u0433\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c<\/h1>\n<p>  <\/p>\n<p>\u041d\u0435 \u0432\u0437\u0438\u0440\u0430\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e <code>iOS Responder Chain<\/code> \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f <code>UIKit<\/code>-\u043e\u043c, \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f\/\u043e\u0431\u0449\u0435\u043d\u0438\u044f. <code>UIResponder<\/code> \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u043e\u0434\u043d\u043e\u0440\u0430\u0437\u043e\u0432\u044b\u0435 <code>NotificationCenter.default.post<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0437\u044c\u043c\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0440\u0443\u0442 <code>UIViewController<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0433\u043b\u0443\u0431\u043e\u043a\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0441\u0442\u0435\u043a\u0435 UINavigationController \u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0435\u043c\u0443 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043a\u043d\u043e\u043f\u043a\u0438 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u043c \u044d\u043a\u0440\u0430\u043d\u0435. \u041c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u0435\u043b\u0430\u0433\u0430\u0442 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u043c \u0438\u043b\u0438 <code>NotificationCenter.default.post<\/code>, \u043d\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u044d\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <code>iOS Responder Chain<\/code>. <\/p>\n<p>  <\/p>\n<pre><code class=\"swift\">button.addTarget(nil, action: #selector(RootVC.doSomething), for: .touchUpInside)<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043c\u0435\u0442\u043e\u0434 \u0432 \u0440\u0443\u0442 <code>UIViewController<\/code>. #selector \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"swift\">func doSomething() func doSomething(sender: Any?) func doSomething(sender: Any?, event: UIEvent?)<\/code><\/pre>\n<p>  <\/p>\n<p>sender \u044d\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043b \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u2014 UIButton, UITextField \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435.<\/p>\n<p>  <\/p>\n<h1 id=\"dopolnitelnye-resursy-dlya-izucheniya-eng\">\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0434\u043b\u044f \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f [eng]:<\/h1>\n<p>  <\/p>\n<p><a href=\"https:\/\/swiftrocks.com\/understanding-the-ios-responder-chain.html\">\u0425\u043e\u0440\u043e\u0448\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 UIEvent, UIResponder \u0438 \u043f\u0430\u0440\u0443 \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432(\u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043e\u0440 \u043f\u0430\u0442\u0435\u0440\u043d)<\/a><br \/>  <a href=\"https:\/\/medium.com\/ios-os-x-development\/understanding-cocoa-and-cocoa-touch-responder-chain-12fe558ebe97\">\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043e ios responder chain<\/a><br \/>  <a href=\"https:\/\/useyourloaf.com\/blog\/using-the-responder-chain\/\">\u041f\u0440\u0438\u043c\u0435\u0440 responder chain \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435<\/a><br \/>  <a href=\"https:\/\/developer.apple.com\/documentation\/uikit\/touches_presses_and_gestures\/using_responders_and_the_responder_chain_to_handle_events\">\u041e\u0444\u0444 \u0434\u043e\u043a\u0430 \u043f\u043e iOS responder chain<\/a><br \/>  <a href=\"https:\/\/developer.apple.com\/documentation\/uikit\/uiresponder\">\u041e\u0444\u0444 \u0434\u043e\u043a\u0430 \u043f\u043e UIResponder<\/a><\/p>\n<\/div>\n<p>               <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/464463\/\"> https:\/\/habr.com\/ru\/post\/464463\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/i-\/tl\/sa\/i-tlsagkacd2zdsmpd70er1tv4a.png\" alt=\"image\"><\/p>\n<p>  <\/p>\n<blockquote><p><em>\u041a\u0430\u043a\u0430\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u043f\u0435\u0440\u0432\u044b\u043c \u0438 \u0432\u0442\u043e\u0440\u044b\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c?<\/em><\/p>\n<p>  <em>\u0417\u0430 \u0447\u0442\u043e \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0442\u0430\u0440\u0433\u0435\u0442?<\/em><\/p>\n<p>  <em>\u0412 \u043a\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043a\u043d\u043e\u043f\u043a\u0438?<\/em><\/p><\/blockquote>\n<p>  <\/p>\n<h1 id=\"tldr\">TL;DR<\/h1>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u043d\u0430\u0448 \u043c\u0435\u0442\u043e\u0434 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043e\u0431\u043e\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445.<\/p>\n<p>  <\/p>\n<p>\u0422\u043e\u043b\u044c\u043a\u043e \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 <em>UIKit<\/em> \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u0432 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u043e\u043c \u0442\u0430\u0440\u0433\u0435\u0442\u0435(\u0443 \u043d\u0430\u0441 \u044d\u0442\u043e <code>ViewController<\/code>). \u0411\u0443\u0434\u0435\u0442 \u043a\u0440\u0430\u0448, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f iOS Responder Chain, <code>UIKit<\/code> \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043a\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u0433\u043e \u0431\u043b\u0438\u0436\u043d\u0435\u0433\u043e <code>UIResponder<\/code>-a \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434. \u041a\u0440\u0430\u0448\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 \u043d\u0430\u0448 \u043c\u0435\u0442\u043e\u0434 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d.<\/p>\n<p>  <\/p>\n<p><code>UIViewController, UIView, UIApplication<\/code> \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0442 \u043e\u0442 <code>UIResponder<\/code>.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-293714","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/293714","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=293714"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/293714\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=293714"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=293714"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=293714"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}