J'essaie de développer une application en utilisant Cocos2d. Je ne peux pas obtenir la valeur de textfield. Comment obtenir la valeur du champ de texte (dans une vue d'alerte) en utilisant Cocos2d?Comment obtenir la valeur du champ de texte par une vue d'alerte en utilisant Cocos2d?
-(void)timed1: (id)sender
{
UIAlertView* dialog = [[[UIAlertView alloc] init] retain];
[dialog setDelegate:self];
[dialog setTitle:@"Enter Time:"];
[dialog setMessage:@" "];
UITextField * nameField = [[UITextField alloc] initWithFrame:CGRectMake(20.0, 45.0, 245.0, 25.0)];
[dialog addSubview:nameField];
[nameField setBackgroundColor:[UIColor whiteColor]];
CGAffineTransform moveUp = CGAffineTransformMakeTranslation(0.0, 70.0);
[dialog setTransform: moveUp];
[dialog setBackgroundColor:[UIColor clearColor]];
[dialog addButtonWithTitle:@"Done"];
[dialog show];
nameField.clearButtonMode = UITextFieldViewModeWhileEditing;
nameField.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
nameField.keyboardAppearance = UIKeyboardAppearanceAlert;
nameField.autocapitalizationType = UITextAutocapitalizationTypeWords;
// timeStatus is a int type global variable
timeStatus =[nameField.text intValue]; // this line not working i can't getting value namefield
[dialog release];
[nameField release];
}
S'il vous plaît comment avez-vous résolu cela? J'ai le même problème: applicaion fenêtre principale va créer sur le bouton nouvelle fenêtre avec le champ de texte mais je ne peux pas accéder à son contenu dans la fenêtre principale alors. – uniquepito