Adding TextField to UIAlertView

前端 未结 9 1371
不知归路
不知归路 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:18

    You can try:

    UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Your title here!" message:@"this gets covered" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil];
    UITextField *myTextField = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 45.0, 260.0, 25.0)];
    [myTextField setBackgroundColor:[UIColor whiteColor]];
    [myAlertView addSubview:testTextField];
    [myAlertView show];
    [myAlertView release];
    

    Follow this link for detail.

提交回复
热议问题