【问题标题】:Change the orientation of UIImage in iPhone/iPad更改 iPhone/iPad 中 UIImage 的方向
【发布时间】:2012-02-20 04:15:27
【问题描述】:

任何人都可以告诉我如何设置我的 UIImage 的方向。也就是说,如果我的 UIImage 方向是 UIImageOrientationDown 那么我想将其更改为 UIImageOrientationUp

谁能告诉我如何做到这一点。

我已经搜索了很多,但到目前为止,我只发现了有关如何获取图像方向的信息。

【问题讨论】:

    标签: iphone ipad uiimage orientation


    【解决方案1】:

    尝试:-

    - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation 
                                    duration:(NSTimeInterval)duration {
    
        if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft) {        
            yourImage.transform = CGAffineTransformMakeRotation(M_PI / 2);
        }
        else if (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight){
            yourImage.transform = CGAffineTransformMakeRotation(-M_PI / 2);
        }
        else {
            yourImage.transform = CGAffineTransformMakeRotation(0.0);
        }
    }
    

    【讨论】:

    • 这是 UIIMage 委托吗?
    • @sHaH.. Nup.... UIViewController 的 ...它将检测方向更改事件
    • 啊...没用的兄弟。 :(
    • @sHaH..: 你想如何改变图像的方向?我的意思是当您更改设备的方向或单击按钮时?
    • 我的应用程序的方向始终是左或右。但是当我打开相机时。它的方向是左、右、上、下。所有的。因此,当我以向下模式拍照时,它应该自动将其旋转到向上模式,如果我以左侧模式拍照,它应该将其旋转到右侧模式。这样我的照片就会以完美的方向出现。希望你明白我的意思
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-14
    • 1970-01-01
    相关资源
    最近更新 更多