我想知道如何将 ar 视图设置为横向模式。
NSLog(@"bound %@",NSStringFromCGRect([self.view bounds]));
NSLog(@"bound %@",NSStringFromCGRect([[UIScreen mainScreen] bounds]));
glView = [[ARView alloc] initWithFrame:[[self view] bounds] pixelFormat:kEAGLColorFormatRGBA8 depthFormat:GL_DEPTH_COMPONENT16_OES stencilFormat:0 preserveBackbuffer:NO];
glView.arViewController = self;
self.view = glView;
UIToolbar *toolbar = [[UIToolbar alloc] init];
toolbar.frame = CGRectMake(0, 255, 480, 44);
toolbar.barStyle = UIBarStyleBlack;
NSMutableArray *items = [[NSMutableArray alloc] init];
[items addObject:[[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(stopAR:)] autorelease]];
[toolbar setItems:items animated:NO];
[items release];
[self.view addSubview:toolbar];
[toolbar release];
试图设置这个但没有效果
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
[super shouldAutorotateToInterfaceOrientation:interfaceOrientation];
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}