我试图将文本字段中的文本放入 UIAlertView,但未显示。它只是显示空白。
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Kik" message:self.kik.text delegate:self cancelButtonTitle:@"Got it!" otherButtonTitles: nil];
[alert show];
你应该试试,
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];
}
查看..