首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我如何解决“语义问题”?

我如何解决“语义问题”?
EN

Stack Overflow用户
提问于 2013-02-26 22:21:33
回答 2查看 562关注 0票数 1

我已经下载了一个模板here

我有XCode 4.6,当我运行它时,我得到了以下结果:

代码语言:javascript
复制
 + (UIImage *)imageWithCVMat:(const cv::Mat&)cvMat orientation:(UIImageOrientation)orientation
{
    return [[UIImage alloc] initWithCVMat:cvMat orientation:orientation];
}

+ (UIImage *)imageWithCVMat:(const cv::Mat&)cvMat
{
    return [[UIImage alloc] initWithCVMat:cvMat orientation:0];
}

我得到了一个错误

代码语言:javascript
复制
Cannot initialize a parameter of type 'UIImageOrientation' with an value of type 'int'

我该怎么解决呢?也许有人知道

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-02-26 22:27:04

该错误与在第二个方便的方法中使用0值有关

在未指定任何方向时选择默认方向

代码语言:javascript
复制
+ (UIImage *)imageWithCVMat:(const cv::Mat&)cvMat {
     return [[UIImage alloc] initWithCVMat:cvMat orientation:UIImageOrientationUp]; 
}
票数 1
EN

Stack Overflow用户

发布于 2013-02-26 22:24:18

此方法

代码语言:javascript
复制
+ (UIImage *)imageWithCVMat:(const cv::Mat&)cvMat
{
return [[UIImage alloc] initWithCVMat:cvMat orientation:0];
}

你不能有orientation:0,因为它需要一个UIImageOrientation类型的对象。也许可以尝试将其设置为nil (不确定是否允许这样做),或者给它一个新的默认UIImageOrientation

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15091436

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档