开发者

Getting Numbers From A CFDictionary For Use In Calculations, iPhone

I found this in my travels:

http://www.opensource.ap开发者_StackOverflowple.com/source/IOKitUser/IOKitUser-502/ps.subproj/IOPSKeys.h

How would I get the values (as a number) of:

#define kIOPSMaxCapacityKey "Max Capacity"

and

#define kIOPSDesignCapacityKey "DesignCapacity"

I want to be able to use them throughout my app. What do I need to add to my project and how do extract the numbers?

Many thanks,

Stuart


Once you know where the actual dictionary is that it's storing these values, you can access the value from the dictionary using the following call:

CFDictionaryGetValue (
   CFDictionaryRef theDict,
   const void *key
);

Further examination of the directory http://www.opensource.apple.com/source/IOKitUser/IOKitUser-502/ps.subproj/ would probably allow you to figure out which objects/methods to call to get the dictionary, and the documentation within the class states what it points to (in your two previously mentioned keys, they point to CFNumbers, so in that case CFDictionaryGetValue will return a CFNumber.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜