Guest User

Untitled

a guest
Jan 18th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. @interface MySingleton : NSObject {
  2. CTFontRef paintingFont;
  3. }
  4.  
  5. @property (readonly) CTFontRef paintingFont;
  6.  
  7. @end
  8.  
  9.  
  10. @implementation MySingleton
  11.  
  12. + (MySingleton*)sharedInstance
  13. {
  14. static dispatch_once_t once;
  15. static MySingleton *sharedInstance;
  16. dispatch_once(&once, ^{
  17. sharedInstance = [[self alloc] init];
  18.  
  19. //NB
  20. sharedInstance->paintingFont =
  21. CTFontCreateWithName(CFSTR("Helvetica"), 80.0, nil);
  22. });
  23. return sharedInstance;
  24. }
  25.  
  26. @end
  27.  
  28. sharedInstance->_paintingFont =
  29. CTFontCreateWithName(CFSTR("Helvetica"), 80.0, nil);
  30.  
  31. @interface MySingleton ()
  32. @property (readwrite) CTFontRef paintingFont;
  33. @end
  34.  
  35. @implementation MySingleton
  36. @synthesize paintingFont;
  37. ....
  38. @end
Add Comment
Please, Sign In to add comment