xcode编译的时候 出现Thread 1: signal SIGABRT
谁帮我看一下链接:http://pan.baidu.com/s/1qYmrMvM密码:ffji...
谁帮我看一下 链接:http://pan.baidu.com/s/1qYmrMvM 密码:ffji
展开
展开全部
修改了一下 GameViewController.m , 这样运行就可以了,没有细看,你可以自己分析一下:
@implementation GameViewController
//- (CardMatchingGame *) game
//{
// if (!_game) _game = [[CardMatchingGame alloc] initWithCardCount:[self.cardButtons count] usingPokemonCard:[self createPokemonCard]];
// return _game;
//}
- (PokemonCard *)createPokemonCard
{
return [[PlayingPokemonCard alloc] init];
}
- (IBAction)touchCardButton:(UIButton *)sender
{
int cardIndex = [self.cardButtons indexOfObject:sender];
_selectedCardIndex = cardIndex;
NSLog(@"touched card %i", cardIndex);
if (!_game) {
_game = [[CardMatchingGame alloc] initWithCardCount:[self.cardButtons count] usingPokemonCard:[self createPokemonCard]];
}
[self.game chooseCardAtIndex:cardIndex];
self.touchedCard = [self.game cardAtIndex:cardIndex];
[self updateUI];
}
- (void) updateUI
{
for (UIButton *cardButton in self.cardButtons) {
int cardIndex = [self.cardButtons indexOfObject:cardButton];
Card *card = [self.game cardAtIndex:cardIndex];
[cardButton.titleLabel setLineBreakMode:NSLineBreakByWordWrapping];
[cardButton setAttributedTitle:[self titleForCard:card]
forState:UIControlStateNormal];
[cardButton setBackgroundImage:[self backgroundImageForCard:card] forState:UIControlStateNormal];
cardButton.enabled = !card.isMatched;
}
self.scoreLabel.text = [NSString stringWithFormat:@"Score: %d", self.game.score];
self.statusLabel.lineBreakMode = NSLineBreakByWordWrapping;
self.statusLabel.numberOfLines = 0;
// [self.statusLabel setAttributedText:[self statusForGame:self.touchedCard
// currentChosenCards:self.game.currentChosenCards
// currentMatchScore:self.game.matchScore]];
}
@implementation GameViewController
//- (CardMatchingGame *) game
//{
// if (!_game) _game = [[CardMatchingGame alloc] initWithCardCount:[self.cardButtons count] usingPokemonCard:[self createPokemonCard]];
// return _game;
//}
- (PokemonCard *)createPokemonCard
{
return [[PlayingPokemonCard alloc] init];
}
- (IBAction)touchCardButton:(UIButton *)sender
{
int cardIndex = [self.cardButtons indexOfObject:sender];
_selectedCardIndex = cardIndex;
NSLog(@"touched card %i", cardIndex);
if (!_game) {
_game = [[CardMatchingGame alloc] initWithCardCount:[self.cardButtons count] usingPokemonCard:[self createPokemonCard]];
}
[self.game chooseCardAtIndex:cardIndex];
self.touchedCard = [self.game cardAtIndex:cardIndex];
[self updateUI];
}
- (void) updateUI
{
for (UIButton *cardButton in self.cardButtons) {
int cardIndex = [self.cardButtons indexOfObject:cardButton];
Card *card = [self.game cardAtIndex:cardIndex];
[cardButton.titleLabel setLineBreakMode:NSLineBreakByWordWrapping];
[cardButton setAttributedTitle:[self titleForCard:card]
forState:UIControlStateNormal];
[cardButton setBackgroundImage:[self backgroundImageForCard:card] forState:UIControlStateNormal];
cardButton.enabled = !card.isMatched;
}
self.scoreLabel.text = [NSString stringWithFormat:@"Score: %d", self.game.score];
self.statusLabel.lineBreakMode = NSLineBreakByWordWrapping;
self.statusLabel.numberOfLines = 0;
// [self.statusLabel setAttributedText:[self statusForGame:self.touchedCard
// currentChosenCards:self.game.currentChosenCards
// currentMatchScore:self.game.matchScore]];
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询