天天看点

UIAlertView 带输入框,且输入框中预先填入字符

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"rename",nil) message:nil delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel",nil) otherButtonTitles:NSLocalizedString(@"OK",nil), nil];
    alert.tag = 1201;
    alert.alertViewStyle = UIAlertViewStylePlainTextInput;
    UITextField *tf = [alert textFieldAtIndex:0];
    tf.text = [[switchList objectAtIndex:lpIndex] name];
    [alert show];