Guest User

Untitled

a guest
May 20th, 2018
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. myFloat = 2.34f;
  2.  
  3. float myFloatValue;
  4. object_getInstanceVariable(self, "myFloat", (void*)&myFloatValue);
  5.  
  6. NSLog(@"%f", myFloatValue);
  7.  
  8. float newValue = 2.34f;
  9. unsigned int addr = (unsigned int)&newValue;
  10.  
  11. object_setInstanceVariable(self, "myFloat", *(float**)addr);
  12.  
  13. NSLog(@"%f", myFloat);
  14.  
  15. (int)object_getIvar(obj, myIntVar)
  16.  
  17. id returnedValue = object_getIvar(self, myIntVar);
  18. NSLog(@"Class: %@", [returnedValue className]);
  19.  
  20. void *ptr_to_result;
  21. object_getInstanceVariable(obj, "intvarname", &ptr_to_result);
  22. float result = *(float *)ptr_to_result;
Add Comment
Please, Sign In to add comment