2013-02-26 39 views
1

我已經下載的模板here我怎樣才能解決「語義問題」

我的XCode 4.6當我運行它,我有以下幾點:

+ (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]; 
} 

,我得到了錯誤

Cannot initialize a parameter of type 'UIImageOrientation' with an value of type 'int' 

我該如何解決它?也許有人知道

回答

1

的錯誤是關於你的第二個簡便方法使用0

選擇時,沒有給出一個默認方向

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

它的工作原理!謝謝 !!! ))) – user2032083 2013-02-26 16:05:07

+0

棒極了!謝謝 – swiftBoy 2015-01-20 07:07:48

0

這種方法

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

你不能有orientation:0,因爲它預計UIImageOrientation類型的對象。也許嘗試使nil(不知道這是允許的)或者給它一個新的默認UIImageOrientation

相關問題