To, for example, access variables in a NSDictionary
Cocoa frameworks often define keys, such as UIKeyboardBoundsUserInfoKey
. How can I check if a key is defined at runtime? I found examples on how to check for classes and functions, but not for constants.
views:
91answers:
1
+8
A:
Check it's pointer against nil, like this
if (&UIKeyboardBoundsUserInfoKey != nil)
{
//Key exists
}
Jasarien
2010-06-26 00:07:54
Thanks, works great.
Johan Kool
2010-06-26 00:15:14