Skip to content

aovestdipaperino/ios-cards

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

iOS Card UI Library

Background

I like making card games for iOS for my friends and family. When I started doing this, I noticed that there were no nice libraries available for rendering attractive looking playing cards. Furthermore, the few that I found used static images for cards, which is frustrating when you, e.g., want to render different card sizes on iPhones and iPads.

I found a nice open source package of playing cards in vector format (https://code.google.com/p/vectorized-playing-cards/), but iOS has limited support for vector graphics.

To work around these issues, I modified the playing card graphics to be pages in a PDF document and use the native PDF rendering capabilities in iOS to render the playing cards at any resolution.

This library is the end result of that series of hacks, and I hope it will be useful to other folks making card games for iOS.

Usage

Draw a single card:

CGFloat width = 100;
CGFloat height = [CardView heightForWidth:width];
CardView *cardView = [[CardView alloc] initWithFrame:CGRectMake(0, 0, width, height)];
cardView.card = [[Card alloc] initWithSuit:Hearts number:King];

See all the cards in a grid:

[self.navigationController pushViewController:[CardsController new]];

Screenshots

Drawn a simple grid at a couple different sizes:

Big

Small

License

This library is available under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html).

The library includes card images released under the LGPL. See https://code.google.com/p/vectorized-playing-cards/.

About

A playing card UI library for iOS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C 100.0%