Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- myFloat = 2.34f;
- float myFloatValue;
- object_getInstanceVariable(self, "myFloat", (void*)&myFloatValue);
- NSLog(@"%f", myFloatValue);
- float newValue = 2.34f;
- unsigned int addr = (unsigned int)&newValue;
- object_setInstanceVariable(self, "myFloat", *(float**)addr);
- NSLog(@"%f", myFloat);
- (int)object_getIvar(obj, myIntVar)
- id returnedValue = object_getIvar(self, myIntVar);
- NSLog(@"Class: %@", [returnedValue className]);
- void *ptr_to_result;
- object_getInstanceVariable(obj, "intvarname", &ptr_to_result);
- float result = *(float *)ptr_to_result;
Add Comment
Please, Sign In to add comment