将枚举值分配给不可比较的类型int [英] Assigning to enum value to incompaitable type int

查看:289
本文介绍了将枚举值分配给不可比较的类型int的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用c ++库。所以我将.m文件转换为.mm文件



现在,我无法设置枚举值。



请参阅枚举

  typedef枚举{
ImageSourceTypeCamera,
ImageSourceTypePhotoLibrary,
ImageSourceTypeNone
}
ImageSourceType;

//属性

  @property(nonatomic,assign)ImageSourceType ImageSourceType; 

现在,当我使用这一行它给我错误

  self.ImageSourceType = 2; / /赋值给'ImageProcessType'与'int'不兼容


解决方案

p>尝试:

  self.ImageSourceType = ImageSourceTypePhotoLibrary 


I am using the c++ library. so i converted my .m file to .mm file.

Now what happens i am not able to set the enum value.

See Enum

 typedef enum{
    ImageSourceTypeCamera,
    ImageSourceTypePhotoLibrary,
    ImageSourceTypeNone
  }
ImageSourceType;

// Property

@property(nonatomic,assign) ImageSourceType ImageSourceType;

Now when i am using this line its give me error

    self.ImageSourceType=2;  / / assigning to 'ImageProcessType' from incompaitable with 'int'

解决方案

Try:

self.ImageSourceType = ImageSourceTypePhotoLibrary

这篇关于将枚举值分配给不可比较的类型int的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆