यह एक अवलोकन भी चीज से ज्यादा है, क्योंकि मैं एक काम के आसपास पाया है दिखाई देते हैं ...[UIDevice currentDevice] .orientation == UIDeviceOrientationUnknown निम्नलिखित UINavigationController धक्का
कोड नीचे काम करने के लिए जब क्या है विफल रहता है एक नियंत्रक जिसे UINavigationController स्टैक पर धक्का दिया गया है। इस स्थिति में [UIDevice currentDevice].orientation
लगातार UIDeviceOrientationUnknown
देता है।
-(void)layoutAccordingToOrientation {
UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
NSLog(@"layoutAccordingToOrientation/orientation==%i", orientation);
if (UIInterfaceOrientationIsLandscape(orientation)) {
:
_detailToolbar.frame = CGRectMake(0, 660, 1024, 44);
} else {
:
_detailToolbar.frame = CGRectMake(0, 916, 768, 44);
}
}
-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
[self layoutAccordingToOrientation];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
निम्नलिखित कॉल किया गया है:
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
if (UIInterfaceOrientationIsLandscape(orientation)) {
etc.
} else {
etc.
}
... जो काम करता है:
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
इस UIDeviceOrientationUnknown
-problem हल करने के लिए, मैं अब के बजाय निम्न का उपयोग हर बार।
फिर भी, मैं यह देखने में असफल रहा कि पहले बदलाव क्यों धक्का दृश्य नियंत्रक के संदर्भ में काम नहीं करेगा। विचार किसी को भी? क्या यह बस एक बग है?
मुझे एक ही समस्या है, हालांकि मैं अपनी स्थिति में काम करने के लिए अपने काम को पाने में सक्षम नहीं हूं। – Flea