我有这样的代码调用该方法(一个,你未注释掉使用)方向后if语句
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
NSLog(@"So the orientation is %d", OrientationInteger);
//1 is button to the left, 0 to the right.
if (OrientationInteger == 1) {
return UIInterfaceOrientationLandscapeLeft;
NSLog(@"setting Orientation landscape left");
}
if (OrientationInteger == 0) {
return UIInterfaceOrientationLandscapeRight;
NSLog(@"setting Orientation landscape right");
}
else {
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
NSLog(@"no instructions regarding orientation.");
}
}
然而,方向不改变,也不是第一次发生火灾后做的日志信息。
NSLog(@"So the orientation is %d", OrientationInteger);
有时候给出'所以方向为1'或'所以方向为2'。 有什么想法?