1
我有一个主视图contatins uitableview,并且当用户点击一行时,我推着另一个视图。我只想让子视图旋转并为其编写代码。但是一旦我推动视图,问题就会出现在主视图上。当我将主视图旋转到左侧时,状态栏也会变为左侧。我没有在主视图上应用任何方向。我在MainView上完成了以下操作,但代码仍然是状态栏不会更改。interfaceorientation在某些意见只
-(void) viewDidLoad
{
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(receivedRotate:) name: UIDeviceOrientationDidChangeNotification object: nil];
}
-(void) receivedRotate: (NSNotification*) notification
{
UIDeviceOrientation interfaceOrientation = [[UIDevice currentDevice] orientation];
if(interfaceOrientation != UIDeviceOrientationUnknown)
{
if (interfaceOrientation==UIInterfaceOrientationLandscapeLeft)
{
[self shouldAutorotateToInterfaceOrientation:interfaceOrientation];
}
}
}
有人可以plz帮助我????它有点急......在你的主视图控制器在主视图我怎么能禁止interfaceOrientation
shouldAutorotate函数没有自动调用,所以我添加了一个通知,并在收到轮转通知时调用该函数。而且我不想在所有视图中旋转,只能在某些视图中旋转。但似乎我的主视图,我没有应用旋转受其子视图的影响。当我旋转主视图时,除状态栏外,所有内容都保持纵向。所以对此有什么帮助? – Jayshree 2010-09-27 13:30:55