您好,下面是我正在使用的代码
currentCardDisplayed = [NSMutableString stringWithFormat:@"%@.png", [[cardsShuffled objectAtIndex:currentCard-1] substringToIndex:[[cardsShuffled objectAtIndex:currentCard-1] length]-1]];
NSString *rule;
if([[currentCardDisplayed stringByAppendingString:@"e"] isEqualToString:currentCardName]){
rule = @"drink";
}else if([[currentCardDisplayed stringByAppendingString:@"2"]isEqualToString:currentCardName]){
rule = @"drink2";
}else if([[currentCardDisplayed stringByAppendingString:@"3"]isEqualToString:currentCardName]){
rule = @"drink3";
}else if([[currentCardDisplayed stringByAppendingString:@"4"]isEqualToString:currentCardName]){
rule = @"drink4";
}else if([[currentCardDisplayed stringByAppendingString:@"5"]isEqualToString:currentCardName]){
rule = @"drink5";
}else if([[currentCardDisplayed stringByAppendingString:@"6"]isEqualToString:currentCardName]){
rule = @"drink6";
}else if([[currentCardDisplayed stringByAppendingString:@"7"]isEqualToString:currentCardName]){
rule = @"drink7";
}else if([[currentCardDisplayed stringByAppendingString:@"8"]isEqualToString:currentCardName]){
rule = @"drink8";
}else if([[currentCardDisplayed stringByAppendingString:@"9"]isEqualToString:currentCardName]){
rule = @"drink9";
}else if([[currentCardDisplayed stringByAppendingString:@"0"]isEqualToString:currentCardName]){
rule = @"drink10";
}else if([[currentCardDisplayed stringByAppendingString:@"k"]isEqualToString:currentCardName]){
rule = @"drinkjack";
}else if([[currentCardDisplayed stringByAppendingString:@"n"]isEqualToString:currentCardName]){
rule = @"drinkqueen";
}else if([[currentCardDisplayed stringByAppendingString:@"g"]isEqualToString:currentCardName]){
rule = @"drinkking";
}
NSLog(@" %@ ", currentCardDisplayed);
NSLog(@" %@ ", currentCardName);
NSLog(@"%@", rule);
NSLog(@" %@", [cardsShuffled objectAtIndex:currentCard-1]);
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Rules" message:rule delegate:nil cancelButtonTitle:@"Okay" otherButtonTitles:nil, nil];
[alert show];
我试图添加到最后的字母没有到达那里。我首先删除了一个字母,但是在我的 if 语句中我想检查我是否向该变量添加了一个不同的字母,它是否等于另一个字符串。
谁能看到我哪里出错了
下面是 nslogs 的示例输出
2012-12-11 20:06:50.853 Kings_1.03[4915:c07] club.png
2012-12-11 20:06:50.855 Kings_1.03[4915:c07] club9.png
2012-12-11 20:06:50.857 Kings_1.03[4915:c07] (null)
2012-12-11 20:06:50.858 Kings_1.03[4915:c07] club9
任何帮助表示赞赏
感谢您