如圖所示,其實要設定iphone固定住橫屏座標,就是這麼簡單,只要設定右圖的程式碼,就可簡單達到目的.
// Override to allow orientations other than the default portrait orientation.這段程式中shouldAutorotateToInterfaceOrientation是UIViewController中的Function,我們只要繼承UIViewController並且覆寫,並設定interfaceOrientation == UIInterfaceOrientationLandscapeRight就可固定設定橫向座標.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
// setting default coordinate
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
如果照程式中的註解return YES; 那麼就可以隨著IPhone轉動變更座標.
在 inof.plist 裡面就可以設定了說 ^0^
回覆刪除