सेब उदाहरणों में आप प्रतिनिधि विधि के माध्यम से सूचित किया जाए:
- (void)orientationChanged:(NSNotification *)notification
{
// We must add a delay here, otherwise we'll swap in the new view
// too quickly and we'll get an animation glitch
NSLog(@"orientationChanged");
[self performSelector:@selector(updateLandscapeView) withObject:nil afterDelay:0];
}
और फिर एक चित्र स्क्रीन प्रदर्शित करने के लिए:
- (void)updateLandscapeView
{
PortraitView *portraitView = [[PortraitView alloc] init];
portraitView.delegate = self;
UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation;
if (UIDeviceOrientationIsLandscape(deviceOrientation) && !isShowingLandscapeView)
{
[self presentModalViewController: portraitView animated:YES];
isShowingLandscapeView = YES;
}
else if (deviceOrientation == UIDeviceOrientationPortrait && isShowingLandscapeView)
{
[self dismissModalViewControllerAnimated:YES];
isShowingLandscapeView = NO;
}
[portraitView release];
}
बेशक
आप काम करने के लिए इस के लिए एक प्रतिनिधि वर्ग के रूप में PortraitView डिजाइन करने के लिए है जैसा सोचा वैसा।
एकमात्र रास्ता नहीं है लेकिन मुझे लगता है कि यह अच्छी तरह से काम करता है और इसके एप्पल उदाहरणों में। मैं इसे Appdelegate में नहीं करूँगा, बल्कि आपका uiview, हालांकि मैं आपके डिजाइन को नहीं जानता।
कृपया मेरा नया उत्तर देखें, मैं आपके समाधान के साथ नई समस्या का वर्णन करूंगा – ludo