Adding TextField to UIAlertView

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

    adding to answer from 'Shmidt', the code to capture text entered in UIAlertView is pasted below (thank you 'Wayne Hartman' Getting text from UIAlertView)

    - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
        if (buttonIndex == 1) {
            self.userNumber = [alertView textFieldAtIndex:0].text;
            if (self.userNumber) {
                // user enetered value
                NSLog(@"self.userNumber: %@",self.userNumber);
            } else {
                NSLog(@"null");
            }
    
        }
    }
    

提交回复
热议问题