
Untitled
By: a guest on
Jul 17th, 2012 | syntax:
None | size: 1.13 KB | hits: 15 | expires: Never
How to transform this NSImage code for use on iOS
// To create the images on the view:
NSRect imageRect = NSMakeRect(24+(i*80), ypos, 72, 96);
NSImageView *theImageView=[[NSImageView alloc] initWithFrame:imageRect];
[theImageView setBounds:imageRect];
[self addSubview:theImageView];
[theImageView setImage:[tCard image]];
[self.imageviews addObject:theImageView];
// To remove the images on the view:
for (NSImageView *timageview in self.imageviews) {
[timageview removeFromSuperview];
}
[self.imageviews removeAllObjects];
//To create the image on the view
UIImageView * theImageView = [[UIImageView alloc] initWithFrame:CGRectMake(24+(i*80), ypos, 72, 96)];
[self addSubview:theImageView];
[theImageView setImage:[tCard image]];
[self.imageviews addObject:theImageView];
// To remove the images on the view:
for (UIImageView *timageview in self.imageviews) {
[timageview removeFromSuperview];
}
[self.imageviews removeAllObjects];
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
self.imageviews = [[NSMutableArray alloc] initWithCapacity:4];
}
return self;