Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 2nd, 2012  |  syntax: None  |  size: 0.45 KB  |  hits: 7  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to define a struct correctly
  2. .h
  3.   struct size{
  4.         int width;
  5.         int height;
  6.    };
  7.  
  8. .m
  9.  
  10.    struct size a;
  11.     a.width = 508;
  12.     a.height = 686;
  13. // I use it here.
  14.        
  15. CGPoint p;
  16. CGSize s;
  17. CGRect r;
  18.  
  19. p.x = 1;
  20. p.y = 2;
  21. // or:
  22. p = CGPointMake(1, 2);
  23.  
  24. s.width = 3;
  25. s.height = 4;
  26. // or:
  27. s = CGSizeMake(3, 4);
  28.  
  29. r.origin.x = 1;
  30. r.origin.y = 2;
  31. r.size.width = 3;
  32. r.size.height = 4;
  33. // or:
  34. r.origin = p;
  35. r.size = s;
  36. // or:
  37. r = CGRectMake(1, 2, 3, 4);