1.先在plist檔案設定支援的方向(可以在項目的general 裡面勾選設定)
2.IOS7 與 ios6的橫屏堅屏設定相同,但與ios5不一樣,IOS5用shouldAutorotateToInterfaceOrientation方法,而ios6 ios7,用supportedInterfaceOrientations and/or shouldAutorotate 代替。
shouldAutorotate表示是否可以橫豎屏
supportedInterfaceOrientations, preferredInterfaceOrientationForPresentation表示支援哪幾種屏方向改變,支援多種時用“|”分隔。
備注:設定了shouldAutorotate為NO時,而某一頁面supportedInterfaceOrientations和preferredInterfaceOrientationForPresentation支援多種時,從其他頁面傳回時屏的方向會與其他頁面相同時(如果支援的話))
3.如果是用UItabViewControler ,UINavigationController包含UIViewController時要category,重寫這幾個方法,并傳回當頁頁面的的這幾個方法狀态