似乎缺少一些东西,但下面的代码正在为两者生成值nil
(即使它正确启动了正确的警报类型并且不指示任何警告或错误)。这种实现可能有什么问题?title
title1
UIAlertView
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"High Score" message:(NSString *)scoreMessage delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
alert.alertViewStyle= UIAlertViewStylePlainTextInput;
UITextField *title1 = [alert textFieldAtIndex:0];
[alert show];
title1= [alert textFieldAtIndex:0];
NSString *title = title1.text;
NSLog(@"The name is %@",title);
NSLog(@"Using the Textfield: %@",[[alert textFieldAtIndex:0] text]);