我是游戏应用程序的新手。我正在尝试实现我们有文本字段的问答游戏。当您键入一个字母时,它会自动移动到下一个文本字段,但不会自动移动到第二个文本字段。有人可以帮我解决这个问题吗?
int i=0,k=0;
while(i<len)
{
int y = 15 +k*44;
int j=0;
for(j=0; j<15;j++)
{
if (i>=len)
break;
if([[CharArray objectAtIndex:i]isEqualToString:@" "])
{
NSLog(@" space i value:%d",i) ;
NSNumber* spaceValues = [NSNumber numberWithInt:i];
[intArray addObject:spaceValues];
NSLog(@"intArray values :%@",intArray);
}
else
{
letterField = [[UITextField alloc] init];
// letterField.text = [CharArray objectAtIndex:i];
[letterField setContentMode:UIViewContentModeCenter];
[letterField setFrame:CGRectMake(30*(j+1)+1*j, y, 30,30)];
letterField.font = [UIFont systemFontOfSize:27.0f];
[letterField setTag:tagCount+300];
letterField.autocapitalizationType = UITextAutocapitalizationTypeNone;
letterField.delegate = self;
[answerView addSubview:letterField];
[letterField release];
tagCount ++;
}
i++;
}
k = k+1;
}
[viewToGuess removeFromSuperview];
[self.view addSubview:answerView];
[self.view bringSubviewToFront:answerView];
answerView.frame = CGRectMake(0, 904, 768, 100);
我正在使用此代码获取 TextField 并为此使用按键通知:
nextTag = nextTag + 1; //increment the tag value while key press.