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

  • SEARCH
  • Home
  • 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 3233348
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:16:00+00:00 2026-05-17T17:16:00+00:00

Alright, so I am working on a simple card game for Mac OS X.

  • 0

Alright, so I am working on a simple card game for Mac OS X. The way I have it set up is with a Card class that holds its own suit and rank, and methods that returns these as NSStrings. What I currently have is a method that pulls random cards out of an array that is the “deck” and puts them into another array that is the player’s “hand”. I am using NSImages to display the cards onscreen.

What I want to do is call the method in the card that will tell me its suit and rank. Then, I have the image of that card stored elsewhere. Those images are named like 3Diamond.png or JackClub.png, because I was thinking that I could set the image by doing something like this. So basically, I have the rank and the suit in strings, and from that I need to change which UIImage I pick. I realize I could do this with a switch or if else statement but that would be really inefficient.

  • 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-05-17T17:16:00+00:00Added an answer on May 17, 2026 at 5:16 pm

    Look at the NSString class reference. Specifically, the +stringWithFormat: method. Then use UIImages +imageNamed: method to load your image.

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

Sidebar

Related Questions

I have a website, with basic Forms Authentication working alright. Users have emails that
I have a very simple script that monitors a file transfer progress, comparing its
Alright I don't see why this isnt working. It seems pretty simple. Here is
Alright have been working to switch to jQuery 1.7's new and improved .on() function
Alright so I'm working on a program written in c++ that is running as
Alright, I've been working on a userscript that redirects when a specific page is
Alright so i have been working on this Dynamic load of a spinner from
Alright, here's my dillema. I am making a simple application with Qt Creator that
Alright here's the situation, I have an application written in the Zend_Framework, that is
Alright, so let's say I have a database with a table named COMPANY_PARAMETERS that

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.