【发布时间】:2012-04-23 21:51:24
【问题描述】:
我没有调用“[sender resignFirstResponder]”方法,但是当按下完成按钮时我的键盘仍然关闭。我需要它保持打开状态,即使我点击完成。我该怎么做?
这是我控制键盘的操作:
- (IBAction)returnKeyButton:(id)sender {
BOOL guessCorrect = [gameModel checkGuess:guessTextField.text];
guessTextField.text = @"";
if (guessCorrect) {
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef soundFileURLRef;
soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"rightAnswer", CFSTR ("mp3"), NULL);
UInt32 soundID;
AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
AudioServicesPlaySystemSound(soundID);
if (gameModel.score == 10) {
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef soundFileURLRef;
soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"win", CFSTR ("mp3"), NULL);
UInt32 soundID;
AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
AudioServicesPlaySystemSound(soundID);
[self endGameWithMessage:@"You win!"];
} else {
scrambledWord.text = [gameModel getScrambledWord];
}
}
remainingTime.text = [NSString stringWithFormat:@"%i", gameModel.time];
playerScore.text = [NSString stringWithFormat:@"%i", gameModel.score];
}
【问题讨论】:
-
重点是,你猜问题的答案。就目前而言,我可以通过使用“return”键来猜测答案,但是每当我按下它时,键盘就会关闭。每次我想输入答案时都必须再次按文本字段,这很烦人。
-
给我几分钟...我有个主意:)
-
这是一个很好的理由......从来没想过!
-
非常感谢!我正在尝试我能想到的一切。
-
知道了!写一个答案....
标签: ios keyboard uitextview