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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:30:41+00:00 2026-06-18T11:30:41+00:00

I am trying to learn Objective-C for iOS. i am currently following the coding

  • 0

I am trying to learn Objective-C for iOS. i am currently following the “coding together” on iTunesU. Although i have got stuck since i can’t get my controller to call on a method from another class. Can’t find what i am doing wrong and thought that StackOverflow might have the solution to it!

The method “flipCardAtIndex” is the one that isn’t working. I have debugged using nslog and from the method “flipCard” i get an output. But when i put in the implementation for flipCardAtIndex i don’t get anything.. So my guess is that it never calls it…
I have made the code a bit shorter so it is only the parts i think is important, this is controller:

#import "ViewController.h"
#import "PlayingCardDeck.h"
#import "CardMatchingGame.h"

@interface ViewController ()

@property (weak, nonatomic) IBOutlet UILabel *flipsLabel;
@property (nonatomic) int flipCount;
@property (weak, nonatomic) IBOutlet UILabel *scoreLabel;
@property (strong, nonatomic) IBOutletCollection(UIButton) NSArray *cardButtons;
@property (strong, nonatomic) CardMatchingGame *game;

@end

@implementation ViewController

- (CardMatchingGame *) game{
    if (_game) _game = [[CardMatchingGame alloc] initWithCardCount:[self.cardButtons     count]
                                                     usingDeck:[[PlayingCardDeck alloc] init]];
    return _game;
}

- (IBAction)flipCard:(UIButton *)sender {

[self.game flipCardAtIndex:[self.cardButtons indexOfObject:sender]];
self.flipCount++;
[self updateUI];

}

And implementation:

- (void)flipCardAtIndex:(NSUInteger)index
{
    NSLog(@"ALL YOUR BASE ARE BELONG TO US");
    Card *card = [self cardAtIndex:index];
}
  • 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-18T11:30:43+00:00Added an answer on June 18, 2026 at 11:30 am

    Fix?

    - (CardMatchingGame *) game{
        if (!_game) _game = [[CardMatchingGame alloc] initWithCardCount:[self.cardButtons        count] usingDeck:[[PlayingCardDeck alloc] init]];
        return _game;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to learn objective c. I have xcode 4 and am reading my
I’m currently trying to learn Objective-C by reading books and online tutorials, also referring
I'm currently trying to learn Cocoa/Objective-C to build Mac OS X softwares. I come
I'm trying to learn objective-c, and have a question regarding this method: - (UITableViewCell
I am trying to learn Objective-C and have run into a problem with pushing
I started to learn objective-c and ios programming.I have two View Controller which are
I'm trying to learn Objective C. I came across the following code which the
So, I've been trying to learn the basics of Objective-C programming for iOS. Now
I'm still trying to learn Objective-C and have an app that downloads documents from
I'm trying to learn Objective-C and iPhone programming, but I'm stuck with a problem.

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.