【发布时间】:2014-05-29 15:23:08
【问题描述】:
所以这个问题:Warning-used as the name of the previous parameter rather than as part of the selector
回答了我的部分问题,但我真的不希望在此方法中进行任何更改,而且我对它的工作原理有点困惑。这是整个方法:
-(void) SetRightWrong:(sqzWord *)word: (int) rightWrong
{
if (self.mastered==nil) {
self.mastered = [[NSMutableArray alloc]initWithCapacity:10];
}
//if right change number right
if (rightWrong == 1) {
word.numberCorrect++;
//if 3 right move to masterd list
[self.onDeck removeObject:word];
if(word.numberCorrect >= 3 )
{
[self.mastered addObject:word];
}
else
{
//if not 3 right move to end of ondeck
[self.onDeck addObject:word];
}
}
else if(rightWrong == 0)
{
//if wrong remove one from number right unless 0
NSUInteger i;
i=[self.onDeck indexOfObject:word];
word = [self.onDeck objectAtIndex:i];
if (word.numberCorrect >0) {
word.numberCorrect--;
}
}
}
我得到的警告是:'word' 用作前一个参数的名称而不是选择器的一部分。
【问题讨论】:
-
您必须更改您的方法名称,这是无法避免的。您需要使方法类似于:
-(void) setRightWrong:(sqzWord *)word withInt:(int)rightWrong其中word是您的sqzWord指针,rightWrong是您的整数。
标签: objective-c xcode