您可以简单地向警报视图询问它的title
,并将其传递给下一个视图控制器。在下一个视图控制器中viewDidLoad
,它可以将标题放在文本字段中。
// In the view controller responsible for the alert view:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
NextViewController *vc = [[NextViewController alloc] init];
vc.titleForTextField = alertView.title;
[self presentViewController:vc animated:YES completion:nil];
}
// In NextViewController:
- (void)viewDidLoad {
[super viewDidLoad];
self.textField.text = self.titleForTextField;
}
(你需要提供NextViewController
一个titleForTextField
属性。)