Guest User

Untitled

a guest
Jul 17th, 2012
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. How to transform this NSImage code for use on iOS
  2. // To create the images on the view:
  3. NSRect imageRect = NSMakeRect(24+(i*80), ypos, 72, 96);
  4. NSImageView *theImageView=[[NSImageView alloc] initWithFrame:imageRect];
  5. [theImageView setBounds:imageRect];
  6. [self addSubview:theImageView];
  7. [theImageView setImage:[tCard image]];
  8. [self.imageviews addObject:theImageView];
  9.  
  10. // To remove the images on the view:
  11. for (NSImageView *timageview in self.imageviews) {
  12. [timageview removeFromSuperview];
  13. }
  14. [self.imageviews removeAllObjects];
  15.  
  16. //To create the image on the view
  17. UIImageView * theImageView = [[UIImageView alloc] initWithFrame:CGRectMake(24+(i*80), ypos, 72, 96)];
  18. [self addSubview:theImageView];
  19. [theImageView setImage:[tCard image]];
  20. [self.imageviews addObject:theImageView];
  21.  
  22. // To remove the images on the view:
  23. for (UIImageView *timageview in self.imageviews) {
  24. [timageview removeFromSuperview];
  25. }
  26. [self.imageviews removeAllObjects];
  27.  
  28. - (id)initWithFrame:(CGRect)frame {
  29. self = [super initWithFrame:frame];
  30. if (self) {
  31. self.imageviews = [[NSMutableArray alloc] initWithCapacity:4];
  32. }
  33. return self;
Advertisement
Add Comment
Please, Sign In to add comment