Using class as key in NSDictionary

前端 未结 7 1440
挽巷
挽巷 2020-12-28 14:00

I\'m writing a contextual \"factory\" that will maintain a dictionary of converter/acting objects which inherit from some Converter class. This class has a method:



        
7条回答
  •  误落风尘
    2020-12-28 14:51

    -setValue:forKey: is documented to take an NSString as the second parameter. You'll have to use NSStringFromClass() and NSClassFromString() as adaptors.

提交回复
热议问题