Jump to content

Unable to add UITextField to UIAlertView on iOS7


zeratuls
 Share

Recommended Posts

Sekojoša problēma mani piemeklēja.

Pēc testiem uz ios7, vecajos ios viss oki doki strādā.

 

Aptuveni paradīšu uz cita parauga kā tas izskatās.

je6Kw.png JIvLR.png

 

Tikai pavirsu tam, man nestrādā arī OK poga :). Lūk mans kods. Varbūt jums ir idejas, ko piekabināt vai izmainīt. Jo gribas, lai no ios 4.3-ios7 viss rukātu.

-(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];
	
  //  m_pNewScoreAlert.alertViewStyle = UIAlertViewStylePlainTextInput;  //cip strada cip nestrada
  //  [m_pNewScoreAlert textFieldAtIndex:0].keyboardType = UIKeyboardTypeAlphabet; //cip strada cip nestrada
    
	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];
    SavePlayInfo();
	[color release];
	[m_pNewScoreAlert release];
    [m_pNameText release];
    
	
}


Dubultais texta lauks itka sanacis + -. Bet datus gan neizdodas vel nolasīt.

Grr kapee apple ta izdarija, ar nabaga developeriem nerekinoties :(



Tiešam neviens ar šo problēmu nav saskāries ?



Pagaidām tik tālu tiku, palika pēdejo elementu pievienot, kur dati saglabājas :)

-(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];
	
    m_pNewScoreAlert.alertViewStyle = UIAlertViewStylePlainTextInput;  //cip strada cip nestrada
    [m_pNewScoreAlert textFieldAtIndex:0].keyboardType = UIKeyboardTypeAlphabet; //cip strada cip nestrada
    
    //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];
    SavePlayInfo();
	[color release];
	[m_pNewScoreAlert release];
    [m_pNameText release];
    
	
}

Šis te zvērs: m_pNameText

 



Varbūt kāds caur tiem viewer var izpalīdzēt :).

Šī problēma nomoka mani jau no 5:00 rīta.

Link to comment
Share on other sites

Izveido kontu, vai pieraksties esošajā, lai komentētu

Jums ir jābūt šī foruma biedram, lai varētu komentēt tēmas

Izveidot jaunu kontu

Piereģistrējies un izveido jaunu kontu, tas būs viegli!

Reģistrēt jaunu kontu

Pierakstīties

Jums jau ir konts? Pierakstieties tajā šeit!

Pierakstīties tagad!
 Share

×
×
  • Izveidot jaunu...