Je veux simplement montrer une valeur double sur une vue uialert c'est possible?objectif-c: programmation iphone: Affichage des variables sur la vue UIAlert
-1
A
Répondre
0
Comment montrez-vous le UIAlertView
maintenant? Quelque chose comme ce qui suit devrait fonctionner:
double myDouble = 12.6;
NSString *alertString = [NSString stringWithFormat:@"%g", myDouble];
UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:alertString
message:nil
delegate:nil
cancelButtonTitle:nil
otherButtonTitles:nil];
[myAlert show];
3
Mettez la valeur dans un format NSString
et l'envoyer à l'alertView:
NSString *messageString = [NSString stringWithFormat:"@number = %.2f", 42.0];
UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:@"Title text" message:messageString delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
[alertView release];