I figured I’d try to learn some iOS development after reading a bit about how good the Stanford/iTunesU CS 193P course is. Coming from only a basic java background, and little-to-no OOP, it’s a bit of a headache, but it’s something i’d really like to complete.
Anyways, the homework for lecture 2 (as you probably have read/watched if you are viewing this blog post) is to:
- Make each ‘flip’ of the card, draw a new card, instead of showing A? each time.
All we have to do, is edit CardGameViewController.h a bit in order to make it work… Add in an import for PlayingCardDeck.h, do some lazy instantiation, and then use setTitle:(NSString *)title forState:(UIControlStateSelected) to update the card. I was scratching my head a bit about how to update the physical view of the card, then realized the setTitle method was mentioned in the lecture 2 slides (page 110).
Anyways, a gist of the CardGameViewController.h is below: