2010-07-14 12 views

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];