Why UITextField becomeFirstResponder returns NO?

前端 未结 5 908
南笙
南笙 2021-01-18 06:48

This is my code:

while (true) {
    if ([identificationField becomeFirstResponder]) {

        NSLog(@\"finally!\");
        break;
    }
    else{
        i         


        
5条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-18 07:28

    Is your identificationField in UIView hierarchy? If it hasn't added into window and shown it cannot became first responder.

提交回复
热议问题