Hor*_*hiv 2 c enums typedef objective-c
嗨,我有一个这样的枚举:
typedef enum {
Top,
Bottom,
Center
} UIItemAlignment;
Run Code Online (Sandbox Code Playgroud)
在我的代码中,我试着像这样使用它:
item.alignment = UIItemAlignment.Top;
Run Code Online (Sandbox Code Playgroud)
我收到这样的错误:"'UIItemAlignment'之前的预期表达式"
如果我只使用:
item.alignment = Top;
Run Code Online (Sandbox Code Playgroud)
一切正常,但如果我尝试以其他方式使用它,为什么会出现此错误?
_alignment是一个NSInteger,它有一个像这样声明的属性
@property (readwrite) NSInteger alignment; 我在我的实现文件中合成了它.
所以我的问题是,为什么我会收到此错误?
| 归档时间: |
|
| 查看次数: |
2312 次 |
| 最近记录: |