IOS 方向開發

 UIDeviceOrientation orientation;

    orientation = [[UIDevice currentDevice] orientation];

    

    switch (orientation) {

        case UIDeviceOrientationFaceUp:

            self.orientationLabel.text=@"Face Up";

            break;

        case UIDeviceOrientationFaceDown:

            self.orientationLabel.text=@"Face Down";

            break;

        case UIDeviceOrientationPortrait:

            self.orientationLabel.text=@"Standing Up";

            break;

        case UIDeviceOrientationPortraitUpsideDown:

            self.orientationLabel.text=@"Upside Down";

            break;

        case UIDeviceOrientationLandscapeLeft:

            self.orientationLabel.text=@"Left Side";

            break;

        case UIDeviceOrientationLandscapeRight:

            self.orientationLabel.text=@"Right Side";

            break;

        default:

            self.orientationLabel.text=@"Unknown";

            break;

    }


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章