{"id":284953,"date":"2017-04-13T18:05:44","date_gmt":"2017-04-13T14:05:44","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=284953"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=284953","title":{"rendered":"\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0433\u043e UI-\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0434\u043b\u044f \u0432\u044b\u0431\u043e\u0440\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0427\u0430\u0441\u0442\u044c 1"},"content":{"rendered":"<p>17 \u043d\u043e\u044f\u0431\u0440\u044f \u0432 \u041c\u043e\u0441\u043a\u0432\u0435 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u041c\u0435\u0436\u0434\u0443\u043d\u0430\u0440\u043e\u0434\u043d\u043e\u0439 \u043a\u043e\u043d\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0438 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 <a href=\"https:\/\/mbltdev.ru\/en\">MBLTdev<\/a> \u0410\u043b\u0435\u043a\u0441\u0430\u043d\u0434\u0440 \u0417\u0438\u043c\u0438\u043d \u0432\u044b\u0441\u0442\u0443\u043f\u0438\u043b \u0441 \u0434\u043e\u043a\u043b\u0430\u0434\u043e\u043c \u043d\u0430 \u0442\u0435\u043c\u0443 \u00ab\u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0437\u0430 \u0440\u0430\u043c\u043a\u0430\u043c\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 UIKit\u00bb. \u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u044d\u0442\u043e\u0442 \u0434\u043e\u043a\u043b\u0430\u0434 \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 iOS-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u043e\u0442\u044f\u0442 \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0445 UI-\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u041c\u0435\u043d\u044f \u043e\u043d \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0440\u0435\u0448\u0438\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0442\u0435\u0437\u0438\u0441\u043e\u0432, \u043e\u0437\u0432\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0432 \u0434\u043e\u043a\u043b\u0430\u0434\u0435. \u041f\u0440\u0438\u043c\u0435\u0440 \u0431\u044b\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043d\u0430 <code>Swift<\/code>, \u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e \u0435\u0433\u043e \u043d\u0430 <code>Objective-C<\/code>.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4><b>\u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 UI-\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b:<\/b><\/h4>\n<p>  <\/p>\n<ul>\n<li>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442: \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u0435 \u0435\u0433\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u043c\u0435\u0442\u043e\u0434\u044b, \u043c\u0435\u0442\u043e\u0434\u044b <code>delegate<\/code> \u0438 <code>dataSource<\/code>. <\/li>\n<li>\u0421\u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0435 \u043e\u0442 <code>UIView+<\/code> \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b. \u041d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0439 <code>UIView<\/code>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443 \u043d\u0430\u0448\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0435\u0441\u0442\u044c <code>contentView<\/code>. \u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u0441\u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0433 \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u0442\u0443\u0434\u0430 \u043b\u044e\u0431\u0443\u044e <code>UIView<\/code>, \u043d\u0435 \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u044f\u0441\u044c \u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430\u0448\u0435\u0433\u043e UI-\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430. <\/li>\n<li>\u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e <code>UIControl<\/code>. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u043a\u0430\u043a\u0430\u044f-\u043b\u0438\u0431\u043e \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u0430\u044f \u043a\u043d\u043e\u043f\u043a\u0430 \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b, \u043b\u0443\u0447\u0448\u0435 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 <code>UIControl<\/code>, \u043d\u0435\u0436\u0435\u043b\u0438 \u043e\u0442 <code>UIView<\/code>. \u0423 <code>UIControl<\/code> \u0435\u0441\u0442\u044c <code>Target-Action<\/code> \u0441\u0438\u0441\u0442\u0435\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u00ab\u043f\u0440\u043e\u0442\u044f\u0433\u0438\u0432\u0430\u0442\u044c\u00bb <code>IBAction<\/code> \u0438\u0437 <code>Interface Builder<\/code> \u043e\u0442 \u043a\u043d\u043e\u043f\u043a\u0438 \u0441\u0440\u0430\u0437\u0443 \u0432 \u043a\u043e\u0434. \u0415\u0433\u043e \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u043c \u043d\u0430\u0434 <code>UIView<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u0438 \u043b\u0443\u0447\u0448\u0435\u0435 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u043a\u0430\u0441\u0430\u043d\u0438\u0439. <\/li>\n<li>\u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u0431\u043b\u0438\u0437\u043a\u0438\u0435 \u043a \u0432\u0430\u0448\u0435\u043c\u0443 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b. <\/li>\n<li>\u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0437\u043d\u044b\u0445 \u0434\u0435\u0432\u0430\u0439\u0441\u043e\u0432, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u043f\u0440\u043e \u0442\u0430\u043a\u0442\u0438\u043b\u044c\u043d\u0443\u044e \u0432\u0438\u0431\u0440\u0430\u0446\u0438\u044e iPhone 7 (\u043a\u043b\u0430\u0441\u0441 <code>UIImpactFeedbackGenerator<\/code>) \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u044d\u043a\u0448\u0435\u043d-\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c\u0438. <\/li>\n<\/ul>\n<p>  <\/p>\n<h4><b>\u0427\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e<\/b><\/h4>\n<p>  \u0412 \u0434\u043e\u043a\u043b\u0430\u0434\u0435 \u0431\u044b\u043b \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0439 <code>UIView<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442 <code>UIPickerView<\/code>. \u041e\u043d\u0430 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0430\u043b\u0430\u0441\u044c \u0434\u043b\u044f \u0432\u044b\u0431\u043e\u0440\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/511\/78d\/ab2\/51178dab2e0a4aa998d9ed30f7687b98.jpg\"\/><\/p>\n<p>  \u042d\u0442\u043e\u0442 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 <code>UIPickerView<\/code>. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c:<\/p>\n<ul>\n<li>\u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0434\u043e\u043a\u0440\u0443\u0442\u043a\u0443;<\/li>\n<li>\u0431\u0430\u0440\u0430\u0431\u0430\u043d \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0435;  <\/li>\n<li>\u0434\u043b\u044f iPhone 7 \u043d\u0443\u0436\u043d\u0430 feedback \u0432\u0438\u0431\u0440\u0430\u0446\u0438\u044f (\u043c\u043d\u043e\u0439 \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e).<\/li>\n<\/ul>\n<p>  <\/p>\n<h4><b>\u041a\u0430\u043a \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c? <\/b><\/h4>\n<p>  \u0412\u043e\u0437\u044c\u043c\u0451\u043c <code>UIView<\/code>, \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0435\u0435 \u043a\u0440\u0443\u0433\u043b\u043e\u0439 \u0438 \u043d\u0430\u0432\u0435\u0441\u0438\u043c \u043d\u0430 \u043d\u0435\u0435 <code>UILabel<\/code> \u0441 \u0447\u0438\u0441\u043b\u0430\u043c\u0438. \u0414\u043b\u044f \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043c <code>UIScrollView<\/code> \u0441 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u043c <code>contentSize<\/code> \u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u0434\u0432\u0438\u0433\u0430 \u0431\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0443\u0433\u043e\u043b \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0430.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/a99\/8ac\/fbe\/a998acfbe14e43918412a00aed603961.png\"\/><\/p>\n<p>  \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e:<\/p>\n<ul>\n<li>\u0432\u044b\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0434\u0432\u0438\u0433 <code>x<\/code>, <code>y<\/code> \u043d\u0430 <code>UIScrollView<\/code>,<\/li>\n<li>\u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0442\u044c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435,<\/li>\n<li>\u043a\u0440\u0443\u0442\u0438\u0442\u044c <code>contentView<\/code>,<\/li>\n<li>\u0434\u043e\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u0442\u044c \u0434\u043e \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430,<\/li>\n<li>\u0434\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043b\u044e\u0431\u043e\u0439 <code>UIView<\/code>.<\/li>\n<\/ul>\n<p>  <\/p>\n<h4><b>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438<\/b><\/h4>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0451\u043c <code>AYNCircleView<\/code>. \u042d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0435\u0441\u044c \u043d\u0430\u0448 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442. \u041d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0433\u043e \u0443 \u043d\u0435\u0433\u043e \u043d\u0435\u0442, \u0434\u0435\u043b\u0430\u0435\u043c \u0432\u0441\u0451 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u043c. \u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u043d\u0430\u0448\u0443 <code>view<\/code> \u0432 <code>Interface Builder<\/code>. \u0421\u0434\u0435\u043b\u0430\u0435\u043c <code>AYNCircleView.xib<\/code> \u0438 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f \u0441 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0435\u0439.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/153\/9d3\/689\/1539d368996640b4910adb6505f21082.jpg\"\/><\/p>\n<p>  \u0418\u0435\u0440\u0430\u0440\u0445\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0442\u0430\u043a\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432:<\/p>\n<ul>\n<li><code>contentView<\/code> \u2014 \u043a\u0440\u0443\u0433, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0443\u0442 \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 <code>subviews<\/code>, <\/li>\n<li><code>scrollView<\/code> \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435. <\/li>\n<\/ul>\n<p>  \u0420\u0430\u0441\u0441\u0442\u0430\u0432\u0438\u043c <code>constraints<\/code>. \u0411\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u0432\u044b\u0441\u043e\u0442\u0430 <code>contentView<\/code> \u0438 <code>bottom space<\/code>. \u041e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u0438 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u0440\u0443\u0433\u0430. \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 <code>constraints<\/code> \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0432\u044b\u043b\u0435\u0437\u0442\u0438 <code>contentView<\/code> \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b <code>superview<\/code>. \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043c \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 <code>contentSize<\/code> \u0443 <code>scrollView<\/code>. \u042d\u0442\u043e \u043d\u0435 \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u0437\u0430\u0442\u043e \u0441\u0438\u043c\u0443\u043b\u0438\u0440\u0443\u0435\u0442 \u00ab\u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0441\u0442\u044c\u00bb \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u0432\u044b \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b \u043a \u043c\u0435\u043b\u043e\u0447\u0430\u043c, \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u00ab\u043f\u0440\u044b\u0436\u043a\u0430\u00bb, \u0447\u0442\u043e\u0431\u044b \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c <code>contentSize<\/code> \u0443 <code>scrollView<\/code>.<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043b\u0430\u0441\u0441 <code>AYNCircleView<\/code>.<\/p>\n<pre><code class=\"objectivec\">@interface AYNCircleView : UIView  @end   static CGFloat const kAYNCircleViewScrollViewContentSizeLength = 1000000000;  @interface AYNCircleView ()  @property (assign, nonatomic) BOOL isInitialized;  @property (assign, nonatomic) CGFloat circleRadius;  @property (weak, nonatomic) IBOutlet UIView *contentView; @property (weak, nonatomic) IBOutlet UIScrollView *scrollView;  @property (weak, nonatomic) IBOutlet NSLayoutConstraint *contentViewDimension; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *contentViewOffset;  @end <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u044b \u0434\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u0435\u0432, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430\u0448\u0430 <code>view<\/code> \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0438\u0437 <code>Interface Builder<\/code> \u0438 \u0432 \u043a\u043e\u0434\u0435.<\/p>\n<pre><code class=\"objectivec\">@implementation AYNCircleView  #pragma mark - Initializers  - (instancetype)initWithFrame:(CGRect)frame {     self = [super initWithFrame:frame];          if (self) {         [self commonInit];     }          return self; }  - (instancetype)initWithCoder:(NSCoder *)aDecoder {     self = [super initWithCoder:aDecoder];          if (self) {         [self commonInit];     }          return self; }  #pragma mark - Private  - (void)commonInit {     UIView *nibView = [[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:self options:nil].firstObject;     [self addSubview:nibView];          self.scrollView.contentSize = CGSizeMake(kAYNCircleViewScrollViewContentSizeLength, kAYNCircleViewScrollViewContentSizeLength);     self.scrollView.contentOffset = CGPointMake(kAYNCircleViewScrollViewContentSizeLength \/ 2.0, kAYNCircleViewScrollViewContentSizeLength \/ 2.0);          self.scrollView.delegate = self; } <\/code><\/pre>\n<p>  \u0420\u0430\u0437\u043c\u0435\u0449\u0430\u0435\u043c \u043d\u0430\u0448\u0443 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e. \u041d\u0435\u043b\u044c\u0437\u044f \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0432 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430\u0445, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u043d\u0435 \u0437\u043d\u0430\u0435\u043c \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 views \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u0437\u043d\u0430\u0442\u044c \u0438\u0445 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 <code>- (void)layoutSubviews<\/code>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0442\u0430\u043c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u0432\u043e\u0434\u0438\u043c \u0440\u0430\u0434\u0438\u0443\u0441 \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0430 \u0448\u0438\u0440\u0438\u043d\u044b \u0438 \u0432\u044b\u0441\u043e\u0442\u044b.<\/p>\n<pre><code class=\"objectivec\">@property (assign, nonatomic) CGFloat circleRadius;<\/code><\/pre>\n<p>  \u0412\u0432\u043e\u0434\u0438\u043c \u0444\u043b\u0430\u0433, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439, \u0447\u0442\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0430.<\/p>\n<pre><code class=\"objectivec\">@property (assign, nonatomic) BOOL isInitialized;<\/code><\/pre>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a \u0441\u043a\u0440\u043e\u043b\u043b \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0432\u044b\u0437\u043e\u0432\u0443 <code>- (void)layoutSubviews<\/code>, \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430\u0448\u0435\u0439 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438. \u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c constraints, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u043d\u0430\u0448\u0438\u0445 <code>views<\/code>.<\/p>\n<pre><code class=\"objectivec\">#pragma mark - Layout  - (void)layoutSubviews {     [super layoutSubviews];          if (!self.isInitialized) {         self.isInitialized = YES;                  self.subviews.firstObject.frame = self.bounds;         self.circleRadius = MIN(CGRectGetWidth(self.bounds), CGRectGetHeight(self.bounds)) \/ 2;                  self.contentView.layer.cornerRadius = self.circleRadius;         self.contentView.layer.masksToBounds = YES;                  [self setNeedsUpdateConstraints];     } }  - (void)updateConstraints {     self.contentViewDimension.constant = self.circleRadius * 2;     self.contentViewOffset.constant = self.circleRadius;      [super updateConstraints]; }<\/code><\/pre>\n<p>  \u0413\u043e\u0442\u043e\u0432\u043e. \u0421\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c <code>view controller<\/code>, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d \u043d\u0430\u0448 \u043a\u043e\u043d\u0442\u0440\u043e\u043b.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/061\/02b\/7e2\/06102b7e25e7428a8ec077f59d9029b3.jpg\"\/><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0436\u0438\u0432\u0443\u044e \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/2f7\/62a\/6a5\/2f762a6a5e1a45f58e8c2a35dee6dbfc.png\"\/><\/p>\n<p>  \u0418\u0435\u0440\u0430\u0440\u0445\u0438\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u0432\u0435\u0440\u043d\u043e, \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c.<\/p>\n<h4><b>\u0424\u043e\u043d\u043e\u0432\u0430\u044f <code>UIView<\/code><\/b><\/h4>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0448\u0430\u0433: \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 <code>backgroundView<\/code>. \u041d\u0430\u0448 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a, \u0447\u0442\u043e \u043d\u0430 \u0444\u043e\u043d \u043c\u043e\u0436\u043d\u043e \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043b\u044e\u0431\u0443\u044e <code>view<\/code>, \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0430 \u043d\u0435 \u0434\u0443\u043c\u0430\u0435\u0442 \u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p>  \u0414\u0435\u043b\u0430\u0435\u043c \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e <code>backgroundView<\/code>:<\/p>\n<pre><code class=\"objectivec\">@property (strong, nonatomic) UIView *backgroundView;<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c, \u043a\u0430\u043a \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0432 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e. \u041f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c <code>setter<\/code>.<\/p>\n<pre><code class=\"objectivec\">- (void)setBackgroundView:(UIView *)backgroundView {     [_backgroundView removeFromSuperview];          _backgroundView = backgroundView;          [_contentView insertSubview:_backgroundView atIndex:0];          if (_isInitialized) {         [self layoutBackgroundView];     } }<\/code><\/pre>\n<p>  \u041a\u0430\u043a\u0430\u044f \u0442\u0443\u0442 \u043b\u043e\u0433\u0438\u043a\u0430? \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0443\u044e <code>view<\/code> \u0438\u0437 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u043e\u0432\u0443\u044e <code>backgroundView<\/code> \u0432 \u0441\u0430\u043c\u044b\u0439 \u043d\u0438\u0436\u043d\u0438\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c \u0435\u0451 \u0440\u0430\u0437\u043c\u0435\u0440 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435.<\/p>\n<pre><code class=\"objectivec\">- (void)layoutBackgroundView {     self.backgroundView.frame = CGRectMake(0, 0, self.circleRadius * 2, self.circleRadius * 2);     self.backgroundView.layer.masksToBounds = YES;     self.backgroundView.layer.cornerRadius = self.circleRadius; }<\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043b\u0443\u0447\u0430\u0439, \u043a\u043e\u0433\u0434\u0430 <code>view<\/code> \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f. \u0427\u0442\u043e\u0431\u044b \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043f\u0440\u043e\u0448\u043b\u043e \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u044b\u0437\u043e\u0432 \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0432 <code>- (void)layoutSubviews<\/code>.<\/p>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u043e\u0432\u0443\u044e \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e. \u0414\u043e\u0431\u0430\u0432\u0438\u043c <code>UIView<\/code> \u043a\u0440\u0430\u0441\u043d\u043e\u0433\u043e \u0446\u0432\u0435\u0442\u0430 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e.<\/p>\n<pre><code class=\"objectivec\">UIView *redView = [UIView new];     redView.backgroundColor = [UIColor redColor];          self.circleView.backgroundView = redView;<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/d53\/ef6\/6e1\/d53ef66e1aba46a1836f2b8a0886706a.png\"\/><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/870\/c8f\/ad3\/870c8fad30c14a3da4d61c5ead47c938.png\"\/><\/p>\n<p>  \u0412\u0441\u0435 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435!<\/p>\n<h4><b>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0446\u0438\u0444\u0435\u0440\u0431\u043b\u0430\u0442\u0430<\/b><\/h4>\n<p>  \u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0446\u0438\u0444\u0435\u0440\u0431\u043b\u0430\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <code>UILabel<\/code>. \u041f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u0441\u044f \u0434\u043e \u0443\u0440\u043e\u0432\u043d\u044f <code>CoreGraphics<\/code> \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0443\u0436\u0435 \u0442\u0430\u043c. \u041d\u0430\u0448\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u2014 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u043d\u0430\u0434 <code>UILabel<\/code>, \u0433\u0434\u0435 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u00ab\u043f\u043e\u0432\u0435\u0440\u043d\u0443\u0442\u0443\u044e\u00bb <code>label<\/code>. \u041a \u043c\u0435\u0442\u043e\u0434\u0443 \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u0438: \u0446\u0432\u0435\u0442 \u0442\u0435\u043a\u0441\u0442\u0430 \u0438 \u0448\u0440\u0438\u0444\u0442.<\/p>\n<pre><code class=\"objectivec\">@interface UILabel (AYNHelpers)  + (UILabel *)ayn_rotatedLabelWithText:(NSString *)text angle:(CGFloat)angle circleRadius:(CGFloat)circleRadius offset:(CGFloat)offset font:(UIFont *)font textColor:(UIColor *)textColor;  @end<\/code><\/pre>\n<p>  \u041c\u0435\u0442\u043e\u0434 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0442\u044c <code>label<\/code> \u043d\u0430 \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u0438. <code>circleRadius<\/code> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0440\u0430\u0434\u0438\u0443\u0441 \u044d\u0442\u043e\u0439 \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u0438, <code>offset<\/code> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u044d\u0442\u043e\u0439 \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u0438, <code>angle<\/code> \u2014 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0439 \u0443\u0433\u043e\u043b. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u043e\u0432\u0451\u0440\u043d\u0443\u0442\u0443\u044e <code>label<\/code> \u0432 \u0446\u0435\u043d\u0442\u0440\u0435 \u044d\u0442\u043e\u0439 \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u0438, \u0430 \u043f\u043e\u0442\u043e\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>xOffset<\/code> \u0438 <code>yOffset<\/code> \u0441\u0434\u0432\u0438\u0433\u0430\u0435\u043c \u0446\u0435\u043d\u0442\u0440 \u044d\u0442\u043e\u0439 <code>label<\/code> \u0432 \u043d\u0443\u0436\u043d\u043e\u0435 \u043c\u0435\u0441\u0442\u043e.<\/p>\n<pre><code class=\"objectivec\">#import &quot;UILabel+AYNHelpers.h&quot;  @implementation UILabel (AYNHelpers)  + (UILabel *)ayn_rotatedLabelWithText:(NSString *)text angle:(CGFloat)angle circleRadius:(CGFloat)circleRadius offset:(CGFloat)offset font:(UIFont *)font textColor:(UIColor *)textColor {     UILabel *rotatedLabel = [[UILabel alloc] initWithFrame:CGRectZero];     rotatedLabel.text = text;          rotatedLabel.font = font ?: [UIFont boldSystemFontOfSize:22.0];     rotatedLabel.textColor = textColor ?: [UIColor blackColor];          [rotatedLabel sizeToFit];          rotatedLabel.transform = CGAffineTransformMakeRotation(angle);          CGFloat angleForPoint = M_PI - angle;          CGFloat xOffset = sin(angleForPoint) * (circleRadius - offset);     CGFloat yOffset = cos(angleForPoint) * (circleRadius - offset);          rotatedLabel.center = CGPointMake(circleRadius + xOffset, circleRadius + yOffset);          return rotatedLabel; }  @end <\/code><\/pre>\n<p>  \u0413\u043e\u0442\u043e\u0432\u043e. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <code>- (void)addLabelsWithNumber:<\/code> \u043d\u0430 \u043d\u0430\u0448 <code>contentView<\/code> \u043b\u0435\u0439\u0431\u043b\u043e\u0432. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0443\u0434\u043e\u0431\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0448\u0430\u0433 \u0443\u0433\u043b\u0430, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u044b \u043f\u043e\u0434\u043f\u0438\u0441\u0438. \u0415\u0441\u043b\u0438 \u0432\u0437\u044f\u0442\u044c \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u044c \u0432 360 \u0433\u0440\u0430\u0434\u0443\u0441\u043e\u0432, \u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u0435\u0439 12, \u0442\u043e \u0448\u0430\u0433 \u0431\u0443\u0434\u0435\u0442 360 \/ 12 = 30 \u0433\u0440\u0430\u0434\u0443\u0441\u043e\u0432. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e, \u043e\u043d\u043e \u043d\u0430\u043c \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u043b\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0443\u0433\u043b\u0430 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0430.<\/p>\n<pre><code class=\"objectivec\">@property (assign, nonatomic) CGFloat angleStep;  \u0414\u0435\u043b\u0430\u0435\u043c  \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b\u0439 offset \u0434\u043b\u044f \u043b\u0435\u0439\u0431\u043b\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u043e\u0436\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u043f\u043e\u0437\u0436\u0435. static CGFloat const kAYNCircleViewLabelOffset = 10;<\/code><\/pre>\n<p>  \u0414\u0435\u043b\u0430\u0435\u043c \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b\u0439 <code>offset<\/code> \u0434\u043b\u044f \u043b\u0435\u0439\u0431\u043b\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u043e\u0436\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u043f\u043e\u0437\u0436\u0435.<\/p>\n<pre><code class=\"objectivec\">- (void)addLabelsWithNumber:(NSInteger)numberOfLabels {     if (numberOfLabels &gt; 0) {         [self.contentView.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {             if ([obj isKindOfClass:[UILabel class]]) {                 [obj removeFromSuperview];             }         }];                  self.angleStep = 2 * M_PI \/ numberOfLabels;         for (NSInteger i = 0; i &lt; numberOfLabels; i++) {             UILabel *rotatedLabel = [UILabel ayn_rotatedLabelWithText:[NSString stringWithFormat:@&quot;%ld&quot;, i]                                                                 angle:self.angleStep * i                                                          circleRadius:self.circleRadius                                                                offset:kAYNCircleViewLabelOffset                                                                  font:self.labelFont                                                             textColor:self.labelTextColor];                          [self.contentView addSubview:rotatedLabel];         }     } } <\/code><\/pre>\n<p>  \u0428\u0430\u0433 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0446\u0438\u0444\u0440 \u043d\u0430 \u0446\u0438\u0444\u0435\u0440\u0431\u043b\u0430\u0442. <\/p>\n<pre><code class=\"objectivec\">@property (assign, nonatomic) NSUInteger numberOfLabels; <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0434\u043b\u044f \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0446\u0438\u0444\u0440 \u043d\u0430 \u0446\u0438\u0444\u0435\u0440\u0431\u043b\u0430\u0442\u0435.<\/p>\n<pre><code class=\"objectivec\">- (void)setNumberOfLabels:(NSUInteger)numberOfLabels {     _numberOfLabels = numberOfLabels;          if (_isInitialized) {         [self addLabelsWithNumber:_numberOfLabels];     } }<\/code><\/pre>\n<p>  \u0418 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0434\u043b\u044f \u043d\u0435\u0433\u043e <code>setter<\/code> \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 <code>backgroundView<\/code>.<br \/>  \u0413\u043e\u0442\u043e\u0432\u043e. \u041a\u043e\u0433\u0434\u0430 <code>view<\/code> \u0443\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0430, \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0446\u0438\u0444\u0440 \u043d\u0430 \u0446\u0438\u0444\u0435\u0440\u0431\u043b\u0430\u0442\u0435. \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u043f\u0440\u043e \u043c\u0435\u0442\u043e\u0434 <code>- (void)layoutSubviews<\/code> \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e <code>AYNCircleView<\/code>. \u0422\u0430\u043c \u0442\u043e\u0436\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0432\u044b\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u0438.<\/p>\n<pre><code class=\"objectivec\">- (void)layoutSubviews {     [super layoutSubviews];          if (!self.isInitialized) {         self.isInitialized = YES;                  \u2026.                  [self addLabelsWithNumber:self.numberOfLabels];                  ...     } } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c <code>- (void)viewDidLoad<\/code> \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430, \u043d\u0430 <code>view<\/code> \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d \u043d\u0430\u0448 \u043a\u043e\u043d\u0442\u0440\u043e\u043b, \u0438\u043c\u0435\u0435\u0442 \u0442\u0430\u043a\u043e\u0439 \u0432\u0438\u0434:<\/p>\n<pre><code class=\"objectivec\">- (void)viewDidLoad {     [super viewDidLoad];          UIView *redView = [UIView new];     redView.backgroundColor = [UIColor redColor];          self.circleView.backgroundView = redView;     self.circleView.numberOfLabels = 12;          self.circleView.delegate = self; } <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e <code>views<\/code> \u0438 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0446\u0438\u0444\u0440.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/870\/c8f\/ad3\/870c8fad30c14a3da4d61c5ead47c938.png\"\/><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/b3d\/77c\/566\/b3d77c566b65435caac5d06c7ae78385.png\"\/><\/p>\n<p>  \u0418\u0435\u0440\u0430\u0440\u0445\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0432\u0435\u0440\u043d\u043e\u0439 \u2014 \u0432\u0441\u0435 \u043d\u0430\u0434\u043f\u0438\u0441\u0438 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u044b \u043d\u0430 <code>contentView<\/code>.<\/p>\n<h4><b>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430<\/b><\/h4>\n<p>  \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u044d\u043a\u0440\u0430\u043d\u0430. \u0427\u0442\u043e\u0431\u044b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u044d\u0442\u0443 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e, \u043e\u0442\u0441\u043b\u0435\u0434\u0438\u043c \u043d\u043e\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e (\u043a\u043b\u0430\u0441\u0441 <code>NSNotification<\/code>) \u043e\u0431 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430. \u041d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 <code>UIDeviceOrientationDidChangeNotification<\/code>.<\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c <code>observer<\/code> \u044d\u0442\u043e\u0439 \u043d\u043e\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0432 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0430 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0442\u0430\u043c \u0436\u0435 \u0432 \u0431\u043b\u043e\u043a\u0435.<\/p>\n<pre><code class=\"objectivec\">__weak __typeof(self) weakSelf = self;     [[NSNotificationCenter defaultCenter] addObserverForName:UIDeviceOrientationDidChangeNotification object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {         __strong __typeof(weakSelf) strongSelf = weakSelf;                  strongSelf.isInitialized = NO;                  [strongSelf setNeedsLayout];     }];<\/code><\/pre>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a \u0431\u043b\u043e\u043a\u0438 \u043d\u0435\u044f\u0432\u043d\u043e \u0437\u0430\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u044e\u0442 <code>self<\/code>, \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a <code>retain cycle<\/code>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0441\u043b\u0430\u0431\u043b\u044f\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 <code>self<\/code>. \u041f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043c\u044b \u043a\u0430\u043a \u0431\u044b \u0437\u0430\u043d\u043e\u0432\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b, \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0440\u0430\u0434\u0438\u0443\u0441 \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u0438, \u043d\u043e\u0432\u044b\u0439 \u0446\u0435\u043d\u0442\u0440 \u0438 \u0442.\u0434.<\/p>\n<p>  \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u043e\u0442\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u0439 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 <code>- (void)dealloc<\/code>.<\/p>\n<pre><code class=\"objectivec\">- (void)dealloc {     [[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil]; }<\/code><\/pre>\n<p>  \u0426\u0438\u0444\u0435\u0440\u0431\u043b\u0430\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d. \u041e \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0435 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0438 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0445 \u0448\u0430\u0433\u0430\u0445 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0430 \u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u0432\u043e <a href=\"https:\/\/habrahabr.ru\/company\/e-Legion\/blog\/326388\/\">\u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438<\/a>.<\/p>\n<p>  \u0412\u0435\u0441\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043d\u0430 <a href=\"https:\/\/github.com\/haron1020\/CustomControl\">\u0433\u0438\u0442\u0435<\/a>.<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:\/\/habrahabr.ru\/post\/326324\/\"> https:\/\/habrahabr.ru\/post\/326324\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>17 \u043d\u043e\u044f\u0431\u0440\u044f \u0432 \u041c\u043e\u0441\u043a\u0432\u0435 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u041c\u0435\u0436\u0434\u0443\u043d\u0430\u0440\u043e\u0434\u043d\u043e\u0439 \u043a\u043e\u043d\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0438 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 <a href=\"https:\/\/mbltdev.ru\/en\">MBLTdev<\/a> \u0410\u043b\u0435\u043a\u0441\u0430\u043d\u0434\u0440 \u0417\u0438\u043c\u0438\u043d \u0432\u044b\u0441\u0442\u0443\u043f\u0438\u043b \u0441 \u0434\u043e\u043a\u043b\u0430\u0434\u043e\u043c \u043d\u0430 \u0442\u0435\u043c\u0443 \u00ab\u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0437\u0430 \u0440\u0430\u043c\u043a\u0430\u043c\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 UIKit\u00bb. \u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u044d\u0442\u043e\u0442 \u0434\u043e\u043a\u043b\u0430\u0434 \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 iOS-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u043e\u0442\u044f\u0442 \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0445 UI-\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u041c\u0435\u043d\u044f \u043e\u043d \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0440\u0435\u0448\u0438\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0442\u0435\u0437\u0438\u0441\u043e\u0432, \u043e\u0437\u0432\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0432 \u0434\u043e\u043a\u043b\u0430\u0434\u0435. \u041f\u0440\u0438\u043c\u0435\u0440 \u0431\u044b\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043d\u0430 <code>Swift<\/code>, \u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e \u0435\u0433\u043e \u043d\u0430 <code>Objective-C<\/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-284953","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/284953","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=284953"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/284953\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=284953"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=284953"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=284953"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}