【发布时间】:2013-09-26 19:06:34
【问题描述】:
我的游戏有问题,它是用 Xcode 开发的。 iOS 7 发布时,我看不到用于输入的文本框,但其他一切正常。而且我不知道如何解决它:(。 http://i.stack.imgur.com/je6Kw.png http://i.stack.imgur.com/JIvLR.png
问题看起来有些相似:)。
这是我的代码,确定按钮也不起作用。
-(void)showRegisterAlert:(PlayerInfo*) play
{
NSString * pMessage = [NSString stringWithFormat:@"%@%d%@", @" Your Score is ", play->nScore, @"\n Enter Your Name\n\n"];
CGRect rect = CGRectMake(50, 75, 180, 20);
// CGRect rect = CGRectMake(50, 50, 180, 43);
m_pNameText = [[UITextField alloc] initWithFrame:rect];
m_pNewScoreAlert = [[UIAlertView alloc]initWithTitle:@"NEW HIGHSCORE" message:pMessage delegate:self
cancelButtonTitle:@"OK" otherButtonTitles:nil];
UIColor * color = [[UIColor alloc] initWithWhite:256.0f alpha:100.0f];
[m_pNameText setBackgroundColor: color];
[m_pNameText becomeFirstResponder];
[m_pNewScoreAlert addSubview:m_pNameText];
m_newPlay.nScore = play->nScore;
[m_pNewScoreAlert show];
[color release];
[m_pNewScoreAlert release];
SavePlayInfo();
}
【问题讨论】:
-
有些人认为我做错了:(。在我的代码中不知何故没有任何作用。不明白我应该在哪里输入这些东西。我只想让文本框和 qwerty 键盘再次工作:)
-
按照该链接中的说明进行操作,他们会的。
-
不要添加自己的文本字段。按照第一条评论中的答案。您需要设置警报视图的
alertViewStyle以获取文本字段。 -
我添加了这个,最终在 ios6 中得到了双文本框:) 在 ios6 中,在 ios7 中只有 1 个。但是当我在文本框中写入数据时,按确定后不保存。代码链接在这里dropbox.com/s/0s1hbeevibw3cdm/code.txt 最后我有双文本框 ios6 和 1 文本框 ios7 至极不保存输入的文本 =D
标签: objective-c uitextfield ios7 uialertview