ARToolkit,如何在横向模式下设置视图
问题描述:
我想知道如何将横向视图设置为横向模式。ARToolkit,如何在横向模式下设置视图
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);
}
答
我不知道你为什么要这么做。 ARView只显示相机的视频。该模型将根据标记方向显示。因此没有必要处理风景或人像模式。 如果您有重叠式视图,则应该在那里处理方向更改。
任何想法如何在叠加视图中添加? – Desmond 2012-02-15 10:52:47
通过向ARView添加子视图来添加覆盖视图 – Mark 2012-05-31 12:12:42