Guest User

Untitled

a guest
Jul 21st, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. +(int) minHeight;
  2. +(int) minWidth;
  3.  
  4. Class *class = NSClassFromString(childClassName);
  5. CGRect frame = CGRectMake(0, 0, [class minWidth], [class minWidth])
  6. MotherClass *view = [[class alloc] initWithFrame:frame];
  7.  
  8. Class<MyCoolView> class = [NSClassFromString(childClassName);
  9. CGRect frame = CGRectMake(0, 0, [class getMinWidth], [class getMinWidth]);
  10. MotherClass *view = [[class alloc] initWithFrame:frame];
  11.  
  12. #import <Foundation/Foundation.h>
  13.  
  14. @interface MyChild
  15. + (int) minHeight;
  16. + (int) minWidth;
  17. @end
  18.  
  19. @implementation MyChild
  20. + (int) minHeight { return 100; }
  21. + (int) minWidth { return 300; }
  22. @end
  23.  
  24. int main(int argc, const char *argv[])
  25. {
  26. NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
  27.  
  28. NSString *className = [NSString stringWithString: @"MyChild"];
  29. Class theClass = NSClassFromString(className);
  30. NSLog(@"%d %d", [theClass minHeight], [theClass minWidth]);
  31.  
  32. [pool drain];
  33. return 0;
  34. }
  35.  
  36. 2011-08-10 18:15:13.877 ClassMethods[5953:707] 100 300
Add Comment
Please, Sign In to add comment