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

Untitled

By: a guest on Jul 17th, 2012  |  syntax: None  |  size: 1.13 KB  |  hits: 15  |  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 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;