I’m making an app for a custom Tarot deck that should be able to shuffle, choose a card, and give a description of the cards.
My main problems are:
-
What to use as the data holder in the Card class. There are 36 cards in all. Each has a different png/text for the frontImage/description but each has the same back image (just like a playing deck would). I assumed this would be an array of some sort but I don’t know how to declare two images and text (front/back/description) and link it to a single index location, or if I need 3 separate arrays, how then would I link them to each other so that they all get the right data?
-
The deck class: I assume will be an empty array which is given the objects from the card class after they have been shuffled? I have a good shuffle method that I have been trying in the console with
NSLogbut basically need to implement it on whatever the card class will be? The deck will then be displayed in “FlowCover” (http://chaosinmotion.com/flowcover.html). This is working and I have sorted out the “didselect” method to change views but- -
The selection: I am unsure about what object will hold and pass the selected data from the deck to the selected view. I assume it will have to be the same object as the card class?
So have a CardClass which contains a static back image (ie the back image is present in every object you instantiate from it). Add properties to the class for the front image and description. Then create your list as a collection of these objects.
Extend your NSMutableClass to have a shuffle routine. See What's the Best Way to Shuffle an NSMutableArray?