iOS typedef NS_ENUM 与 NSString
//在头文件中声明 typedef NS_ENUM(NSUInteger, TransactionState) { TransactionOpened, TransactionPending, TransactionClosed, }; extern NSString * NSStringFromTransactionState(TransactionState state);
//在.m文件中实现 NSString * NSStringFromTransactionState(TransactionState state) { switch (state) { case TransactionOpened: return @"Opened"; case TransactionPending: return @"Pending"; case TransactionClosed: return @"Closed"; default: return nil; } }
Stay hungry,stay foolish.