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 9270475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:22:47+00:00 2026-06-18T15:22:47+00:00

I am a beginner in xcode and objective-c , And I just follow all

  • 0

I am a beginner in xcode and objective-c , And I just follow all the steps in the lesson I have watched in youtube to create hangman game. but there is an error in switch case
when I enter wrong letter the images should be updated but what happen is when I enter the second wrong letter it just go to the default case and start again.
( but in the correct situation, the length of string (WrongLetter) should be incremented by 1 and then enter the case 2 and so on).

The word is: colorado ( For those who will run the program )

if (match==NO)
{
    self.WrongLetter = [self.WrongLetter stringByReplacingOccurrencesOfString:LetterToCheck withString: @""];

    self.WrongLetter = [self.WrongLetter stringByAppendingString:LetterToCheck];


     switch  (self.WrongLetter.length) {
         case 1:
         {self.HangMan.image = [UIImage imageNamed:@"head"];
             break;}
         case 2:{
            self.HangMan.image = [UIImage imageNamed:@"HB"];
             break;}
         case 3:{
            self.HangMan.image = [UIImage imageNamed:@"HBA"];
             break;}
         case 4:{
            self.HangMan.image = [UIImage imageNamed:@"HBAs"];
             break;}
         case 5:{
            self.HangMan.image = [UIImage imageNamed:@"HBAL"];
             break;}
         case 6:{
            self.HangMan.image = [UIImage imageNamed:@"CompleteMan"];
             break;}

         default:{
            [self SetHangManWord:self.CorrectWord];
             break; }

    } }

This is my project:
http://www.2shared.com/file/BLHIQ6kQ/HM_online.html

And this is the lesson in the youtube:
http://www.youtube.com/watch?v=I63BSGsFnEw

I would appreciate any help 🙂

  • 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-18T15:22:48+00:00Added an answer on June 18, 2026 at 3:22 pm

    Change this:

    @property (weak, nonatomic) IBOutlet NSString *WrongLetter;
    

    To this:

    @property (strong, nonatomic) NSString *WrongLetter;
    

    The WrongLetter property gets released too soon. And on second iteration it’s just null.

    It’s a bad practice to name your variables with first letter capitalized. Usually class names get first letter capital.

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

Sidebar

Related Questions

I am a total beginner with Xcode and Objective C, but I have some
I'm a complete beginner to Apple's Xcode, but I have followed the Xcode documentation
I know this is silly question but as a beginner at xcode, and i
I'm trying to learn objective c. I have xcode 4 and am reading my
I'm a beginner in Xcode, but I've programmed in other languages, such as C++.
I have Xcode 3.2.6 and Instruments 2.7 and I am beginner with those applications.
I have Xcode 4.2 and I am a complete beginner. One of my files
I have created a mobile app using Phonegap Build (not just Phonegap...but Build ).
I'm a complete beginner in Objective-C and Cocoa. I would like to create a
As a beginner in objective C and xcode, I am trying to do a

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.