आप अपने UIViewController पर willAnimateRotationToInterfaceOrientation:duration:
विधि का उपयोग करें और फिर लैंडस्केप या पोर्ट्रेट के लिए किसी भी UIViews (या किसी अन्य कोड) स्थान बदल सकते हैं। जैसे
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) {
// change positions etc of any UIViews for Landscape
} else {
// change position etc for Portait
}
// forward the rotation to any child view controllers if required
[self.rootViewController willAnimateRotationToInterfaceOrientation:toInterfaceOrientation duration:duration];
}
यह सुनिश्चित नहीं है कि प्रश्न अभी भी वास्तविक है, लेकिन आप अपने स्वयं के कोड को 'UIViewController' कोड में जोड़ने के लिए objc विधि swizzling का उपयोग कर सकते हैं। यह आपके-अपने कार्यान्वयन के साथ '-didRotateFromInterfaceOrientation:' का आदान-प्रदान जैसा दिखना चाहिए, जिसमें आपके अभिविन्यास को कॉल करने के लिए हैंडलर विधि और मूल कार्यान्वयन के लिए कॉल – medvedNick
@medvedNick उचित लगता है। मैं अपने प्रतिनिधि को बुला सकता हूं और फिर मूल कार्यान्वयन को बुला सकता हूं। मैं संभावित दुष्प्रभावों के बारे में थोड़ा चिंतित हो सकता हूं। –