我在一个Objective-C文件中有以下枚举:
typedef NS_ENUM(NSInteger, countDirection){
countDirectionUp = 0,
countDirectionDown
};
我该如何在Swift视图控制器中使用这个?我尝试过以下方法:
label.countDirection = countDirection.countDirectionDown
我遇到了一个错误:
countDirection.Type没有名为countDirectionDown的成员
label.countDirection = countDirection.Down
或者只写成label.countDirection = .Down
。 - Martin Rvar foo: countDirection; foo = .Down
可以编译通过。 - Martin R