Posted By

mlecho on 04/24/11


Tagged

struct geo


Versions (?)

nsvalue example


 / Published in: Objective C
 

  1. // assume ImaginaryNumber defined:
  2. typedef struct {
  3. float real;
  4. float imaginary;
  5. } ImaginaryNumber;
  6.  
  7. ImaginaryNumber miNumber;
  8. miNumber.real = 1.1;
  9. miNumber.imaginary = 1.41;
  10.  
  11. NSValue *miValue = [NSValue value: &miNumber
  12. withObjCType:@encode(ImaginaryNumber)]; // encode using the type name
  13.  
  14. ImaginaryNumber miNumber2;
  15. [miValue getValue:&miNumber2];

Report this snippet  

You need to login to post a comment.