2010-09-22 48 views
0

我有UIView的一个uiviewtablecontroller添加为子视图,我的设备开始在横向模式,但tableviewcontroller总是在肖像模式UIView的方向变化编程

回答

1

下面的方法“回归是”将使取向的变化,如果它是“返回NO“方向不会改变。在您的视图中使用此方法。

- (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) orientation 
{ 

return YES; 

} 

一切顺利。

0

我的沙盒应用: https://github.com/comonitos/programatical_device_orientation

在接口(H文件):

BOOL rotated; 

在执行(M档):

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
    { 
    return rotated; 
    } 
    -(void) setup 
    { 
    rotated = YES; 
    [[UIDevice currentDevice] setOrientation:UIDeviceOrientationLandscapeLeft]; 
    rotated = NO; 
    }