ios7里面的UITextField不再工作了,老款的ios工作得很好

时间:2013-09-26 19:06:34

标签: objective-c uitextfield ios7 uialertview

我的游戏存在问题,这是在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();

}

1 个答案:

答案 0 :(得分:0)

只需使用您的UIAlertView并将样式类型设置为它。

m_pNewScoreAlert.alertViewStyle = UIAlertViewStylePlainTextInput;