0

我试图将文本字段中的文本放入 UIAlertView,但未显示。它只是显示空白。

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Kik" message:self.kik.text delegate:self cancelButtonTitle:@"Got it!" otherButtonTitles: nil];

[alert show];
4

1 回答 1

0

你应该试试,

if ( [self.kik.text length])
{
UIAlertView *alert = [UIAlertView alloc]initWithTitle:@"Kik" message:[NSString stringWithFormat:@"%@",self.kik.text] delegate:self cancelButtonTitle:@"Got it!" otherButtonTitles: nil];

[alert show];
}
else
{
UIAlertView *alert = [UIAlertView alloc]initWithTitle:@"Kik" message:@"Please enter a valid string" delegate:self cancelButtonTitle:@"Got it!" otherButtonTitles: nil];

[alert show];

}

查看..

于 2013-08-07T07:35:43.593 回答