Tag: 类方法

Objective C类方法与C函数

在开发源代码项目时,我遇到了以下C函数声明和实现: // FSNData.h NSString *stringForMimeType(MimeType type); @interface FSNData : NSObject // All the expected objective-c property and instance method declarations @end // FSNData.m #import “FSNData.h” // where ‘type’ is an enum // this does work as expected NSString *stringForMimeType(MimeType type) { switch (type) { case MimeType_image_jpeg: return @”image/jpeg”; case MimeType_image_png: return @”image/png”; default: NSLog(@”ERROR: FSNData: […]