2012-03-26 66 views
2

我用這來設置設備的方向,iPhone開發設置設備方向編程錯誤

[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight]; 

,但它是「從枚舉類型的隱式轉換‘UIInterfaceOrientation拋出一個警告’,以不同的枚舉類型‘UIPrintInfoOrientation’」。 ,再加上有一個問題,我認爲是由於該警告發生,因爲該警告是,當我運行應用程序,模擬器啓動,但仍然是黑色,應用程序不運行,它說「附加到'APAP名稱」,並沒有什麼發生,現在我想爲某些視圖plz設置設備方向。引導我,有沒有什麼方法或解決去做感謝名單,並認爲薩阿德

+2

UIDevice.orientation是不是隻讀屬性? – onnoweb 2012-03-26 18:51:25

回答

2

,我認爲你應該使用:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 

告知每個接受設備方向的應用的視圖控制器(S ),例如

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    return UIDeviceOrientationLandscapeRight; 
} 
+0

Thanx EddieCatflap,我按照你的建議做了,但沒有發生什麼事情,結果和以前一樣,模擬器啓動,但應用程序沒有啓動,模擬器屏幕仍然黑屏,我不知道最新發生的plz。指南因爲我卡在這裏。 Saad – 2012-03-27 05:13:15

+0

嗨,Saad,這聽起來像是一個更大規模的問題,導致你的應用程序不能成功啓動。當您嘗試在模擬器中運行應用程序時,調試控制檯會顯示可能有助於追蹤問題的任何錯誤消息? – 2012-03-27 12:02:22

+0

不,在調試器中沒有任何錯誤 – 2012-03-27 15:48:55