0

I have a problem with my game, wich was developed in Xcode. When iOS 7 was released, I don't see the textbox for input, but everything else is working. And I don't know how to fix it :(. https://i.stack.imgur.com/je6Kw.png https://i.stack.imgur.com/JIvLR.png

Problem look somethink similar :).

Here is my code, button OK don't work too.

-(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();

}
bneely
  • 9,083
  • 4
  • 38
  • 46
  • See http://stackoverflow.com/questions/18549519/unable-to-add-uitextfield-to-uialertview-on-ios7-works-in-ios-6/18549552#18549552. – Aaron Brager Sep 26 '13 at 19:25
  • Somethink i do very wrong :(. In my code somehow nothing work. Dont understand where i should this stuff enter. I just want textbox and qwerty keyboard again work :) – user2820692 Sep 26 '13 at 19:45
  • Follow the instructions in that link, and they will. – Aaron Brager Sep 26 '13 at 20:17
  • Don't add your own text field. Follow the answer in the first comment. You need to set the alert view's `alertViewStyle` to get a text field. – rmaddy Sep 26 '13 at 20:24
  • I added this, in final got double textbox :) in ios6, in ios7 just 1. But data when i write inside textbox, dont save after i press ok. CODE link here https://www.dropbox.com/s/0s1hbeevibw3cdm/code.txt In final i have double textbox ios6, and 1 textbox ios7 wich dont save inputed text =D – user2820692 Sep 26 '13 at 21:07
  • So far what i done: https://www.dropbox.com/s/y6z8oh4wazuxcuh/m50.png Problem with m_pNameText; – user2820692 Sep 27 '13 at 07:53

1 Answers1

0

Just take your UIAlertView and set the style type to it.

m_pNewScoreAlert.alertViewStyle = UIAlertViewStylePlainTextInput;
aahrens
  • 5,522
  • 7
  • 39
  • 63
  • https://www.dropbox.com/s/0s1hbeevibw3cdm/code.txt upper i have added this stuff, in ios6 now i have 2 text fields, in ios7 just 1. Problem from second i cant anyway get data to saveplayerinfo; Like in old textfield. – user2820692 Sep 27 '13 at 05:11
  • with textfield maybe + - solved half problem, but data should be saved too, what was inputed inside text. – user2820692 Sep 27 '13 at 06:39
  • Maybe with teamviever somebody can help =D – user2820692 Sep 27 '13 at 06:47
  • So far what i done: https://www.dropbox.com/s/y6z8oh4wazuxcuh/m50.png Problem with m_pNameText; – user2820692 Sep 27 '13 at 07:52
  • m_pNameText = [[UITextField alloc] initWithFrame:rect]; Problem with this stuff, because m_pNameText was used to get and save value :(, 12h today lose to fix, and cant fix – user2820692 Sep 27 '13 at 08:57