Just My Life & My Work

Posts tagged ‘rotation’

[iOS] 強制旋轉特定畫面 (Force to Rotate Portrait)

播放影片時特定畫面橫向文章提到播放影片時要橫向,那麼在播放完影片後,想要回復到直向可以怎麼做?

[iOS] 播放影片時特定畫面橫向

原來只要一行程式碼就能搞定!

/**
 Theme: Force to Rotate Portrait
 IDE: Xcode 9
 Language: Objective C
 Date: 107/01/02
 Author: HappyMan
 Blog: https://cg2010studio.com/
 */

[[UIDevice currentDevice] setValue:@(UIInterfaceOrientationPortrait) forKey:@"orientation"];

注意字串orientation

可使用方向的列舉:

typedef NS_ENUM(NSInteger, UIInterfaceOrientation) {

    UIInterfaceOrientationUnknown = UIDeviceOrientationUnknown,

    UIInterfaceOrientationPortrait = UIDeviceOrientationPortrait,

    UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown,

    UIInterfaceOrientationLandscapeLeft = UIDeviceOrientationLandscapeRight,

    UIInterfaceOrientationLandscapeRight = UIDeviceOrientationLandscapeLeft

} __TVOS_PROHIBITED;

參考:How to force view controller orientation in iOS 8?

[iOS] 單一視圖旋轉

專案設定方向(Orientation)只能Portrait,可是在某個視圖(View)想要能夠Landscape,該怎麼做呢?

單一視圖旋轉3

此view只能portrait,點擊圖片進去後,彼view也要能landscape。

(繼續閱讀…)

標籤雲