oOOMIAO 2013-04-15 02:45 采纳率: 10%
浏览 2220
已采纳

苹果中非正式用法ui_orientation

我看见了一段关于ui_orientation的代码如下:

UIImage *finalImage = [[UIImage alloc] initWithCGImage:cgimg
                      scale:2.0f orientation:ui_orientation([displayImage properties])];

很明显作用是读取CCImage的方向来适当创建UIImage。但是我在代码中使用出现了错误: implicit declaration of function 'ui_orientation' is invalid in C99

不知道还要添加什么才能正常使用?
请高手帮忙。

来源:2012WWDC-lesson 510在25'16"

  • 写回答

1条回答

  • prettYYoyic 2013-04-15 09:24
    关注

    来自Session 422, 给出的代码:

    Convert the orientation property to UIImageOrientation:

    UIImageOrientation ui_orientation (NSDictionary* props)
    {
        int o = [[props valueForKey:(id)kCGImagePropertyOrientation] intValue];
        UIImageOrientation map[] = {
            UIImageOrientationUp,
            UIImageOrientationUp, UIImageOrientationUpMirrored,
            UIImageOrientationDown, UIImageOrientationDownMirrored,
            UIImageOrientationLeftMirrored, UIImageOrientationRight,
            UIImageOrientationRightMirrored, UIImageOrientationLeft,
        };
        return map[o];
    }
    

    给一个小提示:下载WWDC session的全部pdf。然后保存在你的硬盘驱动器中。不会占很多空间的。这样你找哪期关于CATransaction 或者编造的函数的时候,可以使用Spotlight帮你找。有session的标题

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)