Adding TextField to UIAlertView

前端 未结 9 1395
不知归路
不知归路 2021-02-12 12:38

I need to add a TextField to an UIAlertView. I understand that apple discourage this approach. So is there any library that i could make use of to add

9条回答
  •  無奈伤痛
    2021-02-12 13:16

    For iOS5:

    UIAlertView *av = [[UIAlertView alloc]initWithTitle:@"Title" message:@"Please enter someth" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil];
    av.alertViewStyle = UIAlertViewStylePlainTextInput;
    [av textFieldAtIndex:0].delegate = self;
    [av show];
    

    Also, you 'll need to implement UITextFieldDelegate, UIAlertViewDelegate protocols.

提交回复
热议问题