2012-02-15 117 views
0

我想知道如何將橫向視圖設置爲橫向模式。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); 
} 

回答

0

我不知道你爲什麼要這麼做。 ARView只顯示相機的視頻。該模型將根據標記方向顯示。因此沒有必要處理風景或人像模式。 如果您有重疊式視圖,則應該在那裏處理方向更改。

+0

任何想法如何在疊加視圖中添加? – Desmond 2012-02-15 10:52:47

+0

通過向ARView添加子視圖來添加覆蓋視圖 – Mark 2012-05-31 12:12:42

相關問題