{"id":155969,"date":"2012-10-24T16:30:04","date_gmt":"2012-10-24T12:30:04","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=155969"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=155969","title":{"rendered":"<span class=\"post_title\">\u0420\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0441 autorotation \u0432 iOS 6<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t\u041f\u0440\u0438\u0432\u0435\u0442, \u0434\u0440\u0443\u0437\u044c\u044f!<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0433\u0430\u0434\u0436\u0435\u0442\u043e\u0432 \u043e\u0442 Apple, \u0442\u043e \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0432 \u043a\u0443\u0440\u0441\u0435, \u0447\u0442\u043e \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 iOS \u0434\u043e \u0432\u0435\u0440\u0441\u0438\u0438 6.<br \/>  \u041d\u0430\u0440\u0430\u0432\u043d\u0435 \u0441 <a href=\"https:\/\/developer.apple.com\/library\/ios\/#releasenotes\/General\/WhatsNewIniPhoneOS\/Articles\/iOS6.html#\/\/apple_ref\/doc\/uid\/TP40011812-SW1\">\u0434\u0440\u0443\u0433\u0438\u043c\u0438<\/a> \u043d\u043e\u0432\u044b\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 Apple \u0432\u043d\u0435\u0441\u043b\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c autorotation. <br \/>  \u041d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u043d\u0430\u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e autorotation \u2014 \u044d\u0442\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043a\u0430\u043a \u0432 \u043f\u043e\u0440\u0442\u0440\u0435\u0442\u043d\u043e\u0439 (\u0432\u044b\u0442\u044f\u043d\u0443\u0442\u043e\u0439 \u0432 \u0432\u044b\u0441\u043e\u0442\u0443), \u0442\u0430\u043a \u0432 \u0430\u043b\u044c\u0431\u043e\u043c\u043d\u043e\u0439 (\u0440\u0430\u0441\u0442\u044f\u043d\u0443\u0442\u043e\u0439 \u0432 \u0448\u0438\u0440\u0438\u043d\u0443) \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u044d\u0442\u0443 \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u043f\u0440\u0438 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430.<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/ff2\/11f\/477\/ff211f477e513bf487f291aeaa0eb88d.png\" alt=\"image\"\/><br \/>  \u0415\u0441\u043b\u0438 \u0432 \u0432\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043a\u043e\u043d\u0442\u0435\u043d\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0432 \u043e\u0431\u0435\u0438\u0445 \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u044f\u0445 (\u0430 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0435\u0441\u043b\u0438 \u043d\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u044d\u043a\u0440\u0430\u043d\u0430\u0445 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u0440\u0435\u0442\u0438\u0442\u044c \u043f\u043e\u0432\u043e\u0440\u043e\u0442) \u2014 \u0433\u043e\u0442\u043e\u0432 \u043f\u043e\u0441\u043f\u043e\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u0443 \u0432\u0430\u0441 \u0443\u0436\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 <a href=\"http:\/\/stackoverflow.com\/questions\/12526054\/autorotate-in-ios-6-has-strange-behaviour\/12538622\">\u0432\u043e\u043f\u0440\u043e\u0441\u044b<\/a>.<br \/>  \u0415\u0441\u043b\u0438 \u0436\u0435 \u0432\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u044d\u043a\u0440\u0430\u043d\u0430 \u2014 \u0440\u0430\u0437\u043d\u0438\u0446\u044b \u043c\u043e\u0433\u043b\u0438 \u0438 \u043d\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c. \u041e\u0434\u043d\u0430\u043a\u043e \u0437\u043d\u0430\u043d\u0438\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432 iOS6 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 autorotation, \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0438 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u041a\u0430\u043a \u0431\u044b\u043b\u043e \u0434\u043e iOS 6<\/h4>\n<p>  \u0423\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043f\u043e\u0434 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c iOS \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 4 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u044d\u043a\u0440\u0430\u043d\u0430, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u044b\u0445 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c\u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430\u043c\u0438:  <\/p>\n<ul>\n<li>UIInterfaceOrientationPortrait<\/li>\n<li>UIInterfaceOrientationPortraitUpsideDown<\/li>\n<li>UIInterfaceOrientationLandscapeLeft<\/li>\n<li>UIInterfaceOrientationLandscapeRight<\/li>\n<\/ul>\n<p>  \u0412 iOS 5 \u0438 \u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u043d\u043d\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445, \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 autorotation \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 <\/p>\n<pre><code>- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {    \/\/ \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c YES \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0439    return (interfaceOrientation == UIInterfaceOrientationPortrait); } <\/code><\/pre>\n<p>  \u041a\u043e\u0433\u0434\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442 \u0441\u0432\u043e\u044e \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435, \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0432\u044b\u0437\u043e\u0432\u0430 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 (view controller), \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043b\u0438 \u043e\u043d \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u0432 \u044d\u0442\u0443 \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u044e.<br \/>  \u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 interfaceOrientation \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0434\u043d\u043e \u0438\u0437 4 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0438 \u043c\u0435\u0442\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u0435\u0440\u043d\u0443\u0442\u044c YES, \u0435\u0441\u043b\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043e\u043a\u043d\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f (\u0438\u043b\u0438 NO \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435).<br \/>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <i>shouldAutorotateToInterfaceOrientation:<\/i> \u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u0438\u043c \u0432\u0438\u0434\u044b \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0438.<\/p>\n<p>  \u041a\u043b\u044e\u0447 UISupportedInterfaceOrientations \u0432 Info.plist \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0439, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c (\u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0438\u0445 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 Summary \u0432\u0430\u0448\u0438\u0445 Targets) \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. <br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/4b1\/645\/4be\/4b16454be593279e4c99db31eab84fc1.png\"\/><\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/c55\/59b\/841\/c5559b841abf6b0bd4c3ab5453a2f2ad.png\"\/><br \/>  \u0415\u0441\u043b\u0438 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0432\u0438\u0434\u0430 \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u2014 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u0442\u0440\u0430\u0448\u043d\u043e\u0433\u043e \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442, \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043e \u0432 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u043f\u043e\u0440\u0442\u0440\u0435\u0442\u043d\u043e\u0439 (UIInterfaceOrientationPortrait).<\/p>\n<h4>\u0421\u0442\u0430\u043b\u043e \u0432 iOS 6<\/h4>\n<p>  \u0412 iOS 6 \u043c\u0435\u0442\u043e\u0434 <i>shouldAutorotateToInterfaceOrientation<\/i> \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u043c (deprecated), \u0430 \u0437\u0430 \u043b\u043e\u0433\u0438\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u044b autorotation \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0442 \u0434\u0432\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u2014 <i>supportedInterfaceOrientations<\/i> \u0438 <i>shouldAutorotate<\/i>.<\/p>\n<p>  \u041f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 (\u0438\u043b\u0438 \u043a\u043e\u0433\u0434\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0443\u0435\u0442\u0441\u044f \u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e) \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043e\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u0441\u0430\u043c\u044b\u0439 \u0432\u0435\u0440\u0445\u043d\u0438\u0439 \u043f\u043e\u043b\u043d\u043e\u044d\u043a\u0440\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 (top-most full-screen view controller). \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0437\u043e\u0432 <i>shouldAutorotate<\/i>, \u0430 \u0437\u0430\u0442\u0435\u043c (\u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f YES) \u2014 \u0432\u044b\u0437\u043e\u0432 <i>supportedInterfaceOrientations<\/i> \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u0438\u0442\u043e\u0432\u043e\u0439 \u043c\u0430\u0441\u043a\u0438, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0435\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043b\u0435\u0434\u0443\u0449\u0438\u0439 \u043a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u043f\u043e\u0434\u0435\u0440\u0436\u043a\u0438 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u043f\u043e\u0440\u0442\u0440\u0435\u0442\u043d\u043e\u0439 \u0438 \u043e\u0431\u0435\u0438\u0445 \u0430\u043b\u044c\u0431\u043e\u043c\u043d\u044b\u0445 \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0439.<\/p>\n<pre><code>- (NSInteger)supportedInterfaceOrientations {    return UIInterfaceOrientationMaskPortrait |            UIInterfaceOrientationMaskLandscapeLeft |            UIInterfaceOrientationMaskLandscapeRight; } <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435, \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u043e\u0442 <i>supportedInterfaceOrientations<\/i> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e <a href=\"http:\/\/ru.wikipedia.org\/wiki\/%D0%9A%D0%BE%D0%BD%D1%8A%D1%8E%D0%BD%D0%BA%D1%86%D0%B8%D1%8F\">\u043a\u043e\u043d\u044a\u044e\u043d\u043a\u0446\u0438\u0438<\/a> (logical AND) \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0439 (\u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0438\u0437 Info.plist \u043b\u0438\u0431\u043e \u043a\u0430\u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043c\u0435\u0442\u043e\u0434\u0430 AppDelegate <i>application:supportedInterfaceOrientationsForWindow:<\/i>). \u041f\u043e \u0438\u0442\u043e\u0433\u0430\u043c \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 (\u0438\u043b\u0438 \u043d\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442) \u043f\u043e\u0432\u043e\u0440\u043e\u0442.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u043a\u0440\u0430\u0442\u0446\u0435, \u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u043f\u0443\u0442\u0435\u043c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438   <\/p>\n<pre><code>app_mask && topmost_controller_mask <\/code><\/pre>\n<p>  \u0433\u0434\u0435 <b>app_mask<\/b> \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0438\u0437 Info.plist (\u043b\u0438\u0431\u043e <i>application:supportedInterfaceOrientationsForWindow:<\/i>), \u0430 <b>topmost_controller_mask<\/b> \u043a\u0430\u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u0437\u043e\u0432\u0430 <i>supportedInterfaceOrientations<\/i> \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u043f\u043e\u043b\u043d\u043e\u044d\u043a\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430.<\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u0441\u0442\u043e\u0438\u0442 \u043f\u0440\u0438\u043d\u044f\u0442\u044c \u0432\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b:<\/p>\n<ul>\n<li>\u0442\u0430\u043a \u043a\u0430\u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 app_mask \u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e, \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0435\u0433\u043e \u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e<\/li>\n<li>\u0434\u043b\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0430 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <i>shouldAutorotate<\/i>, \u0430 \u043d\u0435 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0441 \u043c\u0430\u0441\u043a\u043e\u0439 \u0432 <i>supportedInterfaceOrientations<\/i><\/li>\n<li>\u0435\u0441\u043b\u0438 \u0432 AppDelegate \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 <i>application:supportedInterfaceOrientationsForWindow:<\/i>, \u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0437 Info.plist \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u043e\u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u044b<\/li>\n<li>\u0435\u0441\u043b\u0438 \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u043a\u043e\u043d\u044a\u044e\u043d\u043a\u0446\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 0, \u044d\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043a \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044e <i>UIApplicationInvalidInterfaceOrientationException<\/i><\/li>\n<li>\u0435\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u043c\u0435\u0442\u043e\u0434\u044b <i>supportedInterfaceOrientations<\/i> \u0438 <i>shouldAutorotate<\/i>, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0442\u0438\u043f\u044b \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445 iPad, \u0430 \u043d\u0430 iPhone \u2014 \u0432\u0441\u0435, \u043a\u0440\u043e\u043c\u0435 PortraitUpsideDown<\/li>\n<li>\u043d\u043e\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 <i>preferredInterfaceOrientationForPresentation<\/i> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u0435\u043c\u0443\u044e \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u043f\u0440\u0438 \u0435\u0433\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438<\/li>\n<li><i>shouldAutoRotateToInterfaceOrientation:<\/i> \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 iOS 6, \u043e\u0434\u043d\u0430\u043a\u043e \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e \u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u0441 \u043f\u0440\u043e\u0448\u043b\u044b\u043c\u0438 \u0432\u0435\u0440\u0441\u0438\u044f\u043c\u0438 iOS<\/li>\n<\/ul>\n<p>  \u0422\u0430\u043a\u043e\u0432\u044b \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f. \u0414\u0430\u043d\u043d\u044b\u0439 \u0445\u043e\u0434 \u043f\u0440\u043e\u0434\u0438\u043a\u0442\u043e\u0432\u0430\u043d \u0436\u0435\u043b\u0430\u043d\u0438\u0435\u043c Apple \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0442\u0438 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0437\u0430 \u043f\u0440\u0438\u043d\u044f\u0442\u0438\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u043c \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u044d\u043a\u0440\u0430\u043d\u0430 \u0441 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u043d\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b-\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b \u0438 \u0441\u0430\u043c\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. <\/p>\n<p>   \u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043c\u044b\u0441\u043b\u0438 \u043e\u0442 Apple (Session 236 from WWDC 2012) \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0432\u043e\u0434\u0443 \u0437\u0432\u0443\u0447\u0430\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:  <\/p>\n<ul>\n<li>\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u044c\u0441\u044f \u043a \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0435 \u0432\u0441\u0435\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0440\u0435\u0436\u0438\u043c\u043e\u0432<\/li>\n<li>\u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u043c\u0435\u0442\u044c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u0432 \u043b\u044e\u0431\u043e\u043c \u0444\u0440\u0435\u0439\u043c\u0435, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u0438\u0445 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u0435\u043c<\/li>\n<li>\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u0442\u0438\u043f\u044b \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0438 (Info.plist \u043b\u0438\u0431\u043e <i>application:supportedInterfaceOrientationsForWindow:<\/i>)<\/li>\n<li>\u043f\u0440\u0438 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0435 \u0442\u043e\u043b\u044c\u043a\u043e root \u0438\u043b\u0438 \u0432\u0435\u0440\u0445\u043d\u0438\u0439 \u043f\u043e\u043b\u043d\u043e\u044d\u043a\u0440\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0431\u0443\u0434\u0443\u0442 \u043e\u043f\u0440\u043e\u0448\u0435\u043d\u044b <\/li>\n<\/ul>\n<h4>\u0427\u0442\u043e \u0441 \u044d\u0442\u0438\u043c \u0434\u0435\u043b\u0430\u0442\u044c<\/h4>\n<p>  \u041f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 iOS 5 \u0438 \u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u043d\u043d\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u0439, Apple \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442 \u0441\u0442\u0430\u0440\u0430\u0442\u044c\u0441\u044f \u044d\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b iOS 6:  <\/p>\n<ul>\n<li>\u0432 root \u0438\u043b\u0438 \u043f\u043e\u043b\u043d\u043e\u044d\u043a\u0440\u0430\u043d\u043d\u043e\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0439 \u044d\u043a\u0440\u0430\u043d\u0430<\/li>\n<li>\u0432 child-\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0432\u0441\u0435\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0439<\/li>\n<\/ul>\n<p>   \u041e\u0434\u043d\u0430\u043a\u043e, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0441\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043c\u0438\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c (\u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0443\u0441\u0438\u043b\u0438\u044f\u043c\u0438) \u043d\u0430 iOS 6 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0442, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043e \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0430\u0445 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u043c\u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u043c\u0438? \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 <i>supportedInterfaceOrientations<\/i>\/<i>shouldAutorotate <\/i>\u0440\u044f\u0434\u043e\u043c \u0441 <i>shouldAutorotateToInterfaceOrientation<\/i> \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e \u043d\u0435 \u0441\u043f\u0430\u0441\u0435\u0442, \u0435\u0441\u043b\u0438 \u044d\u0442\u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u043d\u0435 root \u0438 \u043d\u0435 top-most full-screen. \u0427\u0442\u043e\u0431\u044b \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b-\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b \u043f\u0440\u0438\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043a \u043c\u043d\u0435\u043d\u0438\u044e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u0430\u043c\u0438.<\/p>\n<p>  <b>1. \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f.<\/b><br \/>  \u041f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0442\u043e\u043f-\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u043d\u0430 \u043f\u0440\u0435\u0434\u043c\u0435\u0442 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0430. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0434\u043b\u044f UINavigationController \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code>@implementation UINavigationController (RotationIOS6)  -(BOOL)shouldAutorotate {     return [self.topViewController shouldAutorotate]; }  -(NSUInteger)supportedInterfaceOrientations {     return [self.topViewController supportedInterfaceOrientations]; }  - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {     return [self.topViewController preferredInterfaceOrientationForPresentation]; } @end <\/code><\/pre>\n<p>  <b>2. \u041d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435.<\/b><br \/>  \u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e \u0436\u0435, \u0447\u0442\u043e \u0438 \u0432 \u043f\u0443\u043d\u043a\u0442\u0435 1, \u043d\u043e \u043f\u0443\u0442\u0435\u043c \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0442 UINavigationController \u2014 \u043a\u043e\u0433\u0434\u0430 \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0432\u0435\u0440\u0433\u0430\u0442\u044c \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0441\u0440\u0430\u0437\u0443 \u0432\u0441\u0435 UINavigationController-\u044b.<\/p>\n<pre><code>\/\/ CustomNavigationController.h  @interface CustomNavigationController : UINavigationController  @end <\/code><\/pre>\n<pre><code>\/\/ CustomNavigationController.m  #import &quot;CustomNavigationController.h&quot;  @implementation CustomNavigationController  -(BOOL)shouldAutorotate {     return [self.topViewController shouldAutorotate]; }  -(NSUInteger)supportedInterfaceOrientations {     return [self.topViewController supportedInterfaceOrientations]; }  - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {     return [self.topViewController preferredInterfaceOrientationForPresentation]; }  @end <\/code><\/pre>\n<p>  <b>3. Method swizzling.<\/b><br \/>  \u0414\u043b\u044f \u043b\u044e\u0431\u0438\u0442\u0435\u043b\u0435\u0439 runtime \u0438 \u043f\u043e\u043a\u043b\u043e\u043d\u043d\u0438\u043a\u043e\u0432 \u0445\u0430\u0440\u0434\u043a\u043e\u0440\u0430 \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <a href=\"http:\/\/en.wikipedia.org\/wiki\/Pointer_swizzling\">swizzling<\/a>, \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0437\u043e\u0432\u044b \u0441\u0442\u0430\u0440\u043e\u0433\u043e \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 <i>shouldAutorotateToInterfaceOrientation:<\/i>. <\/p>\n<p>  (\u043a\u043e\u0434 \u0432\u0437\u044f\u0442 <a href=\"https:\/\/gist.github.com\/3725118\">\u043e\u0442\u0441\u044e\u0434\u0430<\/a>)<\/p>\n<pre><code>@implementation AppDelegate void SwapMethodImplementations(Class cls, SEL left_sel, SEL right_sel) {     Method leftMethod = class_getInstanceMethod(cls, left_sel);     Method rightMethod = class_getInstanceMethod(cls, right_sel);     method_exchangeImplementations(leftMethod, rightMethod); }  + (void)initialize {     if (self == [AppDelegate class]) { #ifdef __IPHONE_6_0         SwapMethodImplementations([UIViewController class], @selector(supportedInterfaceOrientations), @selector(sp_supportedInterfaceOrientations));         SwapMethodImplementations([UIViewController class], @selector(shouldAutorotate), @selector(sp_shouldAutorotate)); #endif     } } @end  @implementation UIViewController (iOS6Autorotation) #ifdef __IPHONE_6_0 \/*  * We've swizzled the new iOS 6 autorotation callbacks onto their iOS 5 and iOS 4 equivalents  * to preserve existing functionality.  *  *\/ - (BOOL)sp_shouldAutorotate {     BOOL shouldAutorotate = YES;     if ([self respondsToSelector:@selector(shouldAutorotateToInterfaceOrientation:)]) {         NSUInteger mask = 0;         if ([self shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationPortrait]) {             mask |= UIInterfaceOrientationMaskPortrait;         }         if ([self shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeLeft]) {             mask |= UIInterfaceOrientationMaskLandscapeLeft;         }         if ([self shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeRight]) {             mask |= UIInterfaceOrientationMaskLandscapeRight;         }         if ([self shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationPortraitUpsideDown]) {             mask |= UIInterfaceOrientationMaskPortraitUpsideDown;         }         if (mask == 0) {             \/\/ Shouldn't autorotate to *any* orientation.             shouldAutorotate = NO;         }     } else {         \/\/ This actually calls the original method implementation         \/\/ instead of recursively calling into this method implementation.         shouldAutorotate = [self sp_shouldAutorotate];     }     return shouldAutorotate; }  - (NSUInteger)sp_supportedInterfaceOrientations {     NSUInteger mask = 0;          \/*      * In iOS 6, Apple dramatically changed the way autorotation works.      * Rather than having each view controller respond to shouldAutorotateToInterfaceOrientation:      * to specify whether or not it could support a particular orientation, the responsibility was      * shifted to top-level container view controllers. That means UINavigationController becomes      * responsible for declaring whether or not an orientation is supported. Since our app      * has logic for how to autorotate on a per view controller basis, we call through to the      * swizzled version of supportedInterfaceOrientations for the topViewController.      *      *\/     if ([self isKindOfClass:[UINavigationController class]]) {         return [[(UINavigationController *)self topViewController] supportedInterfaceOrientations];     }          if ([self respondsToSelector:@selector(shouldAutorotateToInterfaceOrientation:)]) {         if ([self shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationPortrait]) {             mask |= UIInterfaceOrientationMaskPortrait;         }         if ([self shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeLeft]) {             mask |= UIInterfaceOrientationMaskLandscapeLeft;         }         if ([self shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeRight]) {             mask |= UIInterfaceOrientationMaskLandscapeRight;         }         if ([self shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationPortraitUpsideDown]) {             mask |= UIInterfaceOrientationMaskPortraitUpsideDown;         }     } else {         \/\/ This actually calls the original method implementation         \/\/ instead of recursively calling into this method implementation.         mask = [self sp_supportedInterfaceOrientations];     }     return mask; } #endif @end<\/code><\/pre>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043e\u0434\u0430 \u2014 \u043c\u0430\u0433\u0438\u044f runtime \u0441\u0434\u0435\u043b\u0430\u0435\u0442 \u0441\u0432\u043e\u0435 \u0434\u0435\u043b\u043e. \u041e\u0434\u043d\u0430\u043a\u043e, \u043a\u0430\u043a \u0431\u044b \u0437\u0430\u043c\u0430\u043d\u0447\u0438\u0432\u043e \u044d\u0442\u043e \u043d\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u043e, <u><b>\u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e<\/b><\/u> <b><a href=\"http:\/\/stackoverflow.com\/questions\/5339276\/what-are-the-dangers-of-method-swizzling-in-objective-c\">(\u0443\u0437\u043d\u0430\u0442\u044c, \u043f\u043e\u0447\u0435\u043c\u0443)<\/a><\/b>.<\/p>\n<p>  \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0441\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f\u043c\u0438.<\/p>\n<p>  \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043a\u043e\u043c\u0443-\u0442\u043e \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0438 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u0441\u0430\u043c\u044b\u0439 \u0446\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u0441\u0443\u0440\u0441 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u2014 \u0432\u0440\u0435\u043c\u044f \ud83d\ude42<\/p>\n<p>  <u>\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438:<\/u>   <\/p>\n<ul>\n<li><a href=\"http:\/\/developer.apple.com\/library\/ios\/#featuredarticles\/ViewControllerPGforiPhoneOS\/RespondingtoDeviceOrientationChanges\/RespondingtoDeviceOrientationChanges.html\">View Controller Programming Guide for iOS<\/a><\/li>\n<li><a href=\"http:\/\/adcdownload.apple.com\/\/wwdc_2012\/wwdc_2012_session_pdfs\/236__the_evolution_of_view_controllers_on_ios.pdf\">WWDC 2012, Session 236 \u00abView Controller Evolution\u00bb<\/a><\/li>\n<li><a href=\"http:\/\/cocoadev.com\/wiki\/MethodSwizzling\">Method Swizzling<\/a><\/li>\n<\/ul>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/155969\/\"> http:\/\/habrahabr.ru\/post\/155969\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t\u041f\u0440\u0438\u0432\u0435\u0442, \u0434\u0440\u0443\u0437\u044c\u044f!<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0433\u0430\u0434\u0436\u0435\u0442\u043e\u0432 \u043e\u0442 Apple, \u0442\u043e \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0432 \u043a\u0443\u0440\u0441\u0435, \u0447\u0442\u043e \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 iOS \u0434\u043e \u0432\u0435\u0440\u0441\u0438\u0438 6.<br \/>  \u041d\u0430\u0440\u0430\u0432\u043d\u0435 \u0441 <a href=\"https:\/\/developer.apple.com\/library\/ios\/#releasenotes\/General\/WhatsNewIniPhoneOS\/Articles\/iOS6.html#\/\/apple_ref\/doc\/uid\/TP40011812-SW1\">\u0434\u0440\u0443\u0433\u0438\u043c\u0438<\/a> \u043d\u043e\u0432\u044b\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 Apple \u0432\u043d\u0435\u0441\u043b\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c autorotation. <br \/>  \u041d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u043d\u0430\u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e autorotation \u2014 \u044d\u0442\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043a\u0430\u043a \u0432 \u043f\u043e\u0440\u0442\u0440\u0435\u0442\u043d\u043e\u0439 (\u0432\u044b\u0442\u044f\u043d\u0443\u0442\u043e\u0439 \u0432 \u0432\u044b\u0441\u043e\u0442\u0443), \u0442\u0430\u043a \u0432 \u0430\u043b\u044c\u0431\u043e\u043c\u043d\u043e\u0439 (\u0440\u0430\u0441\u0442\u044f\u043d\u0443\u0442\u043e\u0439 \u0432 \u0448\u0438\u0440\u0438\u043d\u0443) \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u044d\u0442\u0443 \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u043f\u0440\u0438 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430.<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/ff2\/11f\/477\/ff211f477e513bf487f291aeaa0eb88d.png\" alt=\"image\"\/><br \/>  \u0415\u0441\u043b\u0438 \u0432 \u0432\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043a\u043e\u043d\u0442\u0435\u043d\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0432 \u043e\u0431\u0435\u0438\u0445 \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u044f\u0445 (\u0430 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0435\u0441\u043b\u0438 \u043d\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u044d\u043a\u0440\u0430\u043d\u0430\u0445 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u0440\u0435\u0442\u0438\u0442\u044c \u043f\u043e\u0432\u043e\u0440\u043e\u0442) \u2014 \u0433\u043e\u0442\u043e\u0432 \u043f\u043e\u0441\u043f\u043e\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u0443 \u0432\u0430\u0441 \u0443\u0436\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 <a href=\"http:\/\/stackoverflow.com\/questions\/12526054\/autorotate-in-ios-6-has-strange-behaviour\/12538622\">\u0432\u043e\u043f\u0440\u043e\u0441\u044b<\/a>.<br \/>  \u0415\u0441\u043b\u0438 \u0436\u0435 \u0432\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u044d\u043a\u0440\u0430\u043d\u0430 \u2014 \u0440\u0430\u0437\u043d\u0438\u0446\u044b \u043c\u043e\u0433\u043b\u0438 \u0438 \u043d\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c. \u041e\u0434\u043d\u0430\u043a\u043e \u0437\u043d\u0430\u043d\u0438\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432 iOS6 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 autorotation, \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0438 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c.  <\/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-155969","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/155969","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=155969"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/155969\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=155969"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=155969"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=155969"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}