Skip to content

Commit

Permalink
Made card smaller and added 11 cards to the screen.
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Sandoval committed Feb 3, 2013
1 parent a8f8b1c commit 78df052
Show file tree
Hide file tree
Showing 2 changed files with 238 additions and 13 deletions.
22 changes: 14 additions & 8 deletions Matchismo/CardGameViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,29 @@
@interface CardGameViewController ()
@property (weak, nonatomic) IBOutlet UILabel *flipsLabel;
@property (nonatomic) NSUInteger flipCount;
@property (strong, nonatomic) PlayingCardDeck* playingDeck;
@property (strong, nonatomic) Deck* deck;
@property (strong, nonatomic) IBOutletCollection(UIButton) NSArray *cardButtons;
@end

@implementation CardGameViewController

- (PlayingCardDeck*) playingDeck {
if (!_playingDeck) {
_playingDeck = [[PlayingCardDeck alloc] init];
- (void) setCardButtons:(NSArray *)cardButtons {
_cardButtons = cardButtons;
for(UIButton* cardButton in self.cardButtons) {
[cardButton setTitle:[[self.deck drawRandomCard] contents] forState:UIControlStateSelected];
}
return _playingDeck;
}

- (Deck*) deck {
if (!_deck) {
_deck = [[PlayingCardDeck alloc] init];
}
return _deck;
}

- (IBAction)flipCard:(UIButton*)sender {
if (!sender.isSelected) {
[sender setTitle:[self.playingDeck drawRandomCard].contents forState:UIControlStateSelected];
if (!sender.isSelected)
self.flipCount++;
}
sender.selected = !sender.isSelected;
}

Expand Down
Loading

0 comments on commit 78df052

Please sign in to comment.