Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7748219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:43:35+00:00 2026-06-01T10:43:35+00:00

I’m making an app for a custom Tarot deck that should be able to

  • 0

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:

  1. 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?

  2. 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 NSLog but 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-

  3. 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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T10:43:36+00:00Added an answer on June 1, 2026 at 10:43 am
    1. The typical way to link three ‘things’ to a single index location, is to put the things into a single class, and then put objects of that class at the index location.
    2. The deck can be a simple NSMutableArray, which is objective-c’s editable container of objects
    3. The selection can be a second NSMutableArray or you can add a selected property to each card. Both are viable choices but your algorithms will be different depending.

    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.

    //Card.h
    @interface Card : NSObject
    
    {
        UIImage * back;
        UIImage * front;
        NSString * description;
    }
    @property (readonly) UIImage * back;
    @property (readonly) UIImage * front;
    @property (readonly) NSString * description;
    - (id) initWithFront:(UIImage *)setFront Description:(NSString*)setDescription; 
    @end
    
    //Card.m
    #import "Card.h"
    
    static UIImage * backimage = nil;
    
    @implementation Card
    @synthesize back;
    @synthesize front;
    @synthesize description;
    
    +(void) initialize
    {
        if (!backimage){
            backimage = [[UIImage alloc]initWithContentsOfFile:@"imagefile.png"]; //though imagefile.png will be replaced with a reference to a plist.info string 
        }
    }
    
    - (id) initWithFront:(UIImage *)setFront Description:(NSString*)setDescription{
        if (self = [super init]){
            front=setFront;
            description= setDescription;
            back = backimage;
        }
        return self;
    }
    @end
    
    //... elsewhere, perhaps your main viewDidLoad method
    NSMutableArray *deck = [NSMutableArray initWithCapacity:36];
    Card * card1 = [[CardClass alloc] initWithFront:@"card1.png" Description:@"card 1"];
    [deck addObject:card1];
    ... //etc to create the remaining cards in the whole deck
    

    Extend your NSMutableClass to have a shuffle routine. See What's the Best Way to Shuffle an NSMutableArray?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
We're building an app, our first using Rails 3, and we're having to build
I need a function that will clean a strings' special characters. I do NOT
I am writing an app with both english and french support. The app requests

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.