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