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

Alright so here is my issue. I'm working a game engine that will eventually
Alright, currently I have my SWF hitting a php file that will go and
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
I have created a VB.NET 2008 Class Library that has, for the most part,
Alright, I'm working on a (supposed-to-be) simple counting script using ncurses. Everytime it increments
I have a really, really simple class and I am tried to use the
Just more asynchronous stuff! Alright, so I now have a working asynchronous socket program
I've written a multi-project .vstemplate file, which works alright, except that the projects have
In my working folder of a VSS project, is it alright if I make

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.