我看见了一段关于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"
来自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
的标题
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。