Skip to content

Instantly share code, notes, and snippets.

@rcdilorenzo
Created July 25, 2012 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rcdilorenzo/3176888 to your computer and use it in GitHub Desktop.
Save rcdilorenzo/3176888 to your computer and use it in GitHub Desktop.
Draw Card from Image
- (void)drawFromPosition:(CGPoint)location view:(UIView *)view size:(CGFloat)size {
UIImage *cardImage = [UIImage imageNamed:[NSString stringWithFormat:@"%@%@.png", [[self.suit substringToIndex:1] lowercaseString], [[self.rank substringToIndex:1] lowercaseString]]];
UIImageView *cardImageView = [[UIImageView alloc] initWithFrame:CGRectMake(location.x, location.y, cardImage.size.width*size, cardImage.size.height*size)];
[cardImageView setImage:cardImage];
[view addSubview:cardImageView];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment