ios pop界面 鍵盤彈起又收回

UItextFiled:
添加UITextFieldDelegate
並使alert調用出來的textField的delegate = self;
最後在alert的點擊事件處添加[[alertView textFieldAtIndex:buttonIndex]resignFirstResponder];
親測可行
  1. [代碼]鍵盤popViewControllerAnimated後再次彈起
    //返回到上一界面
    -(void)customBackBtnPressed:(id)send{代理

    UIAlertView *alertView=  [[UIAlertView alloc] initWithTitle:@"舒適提示" message:@"還差一步就完成註冊!  肯定放棄?"  delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"肯定",nil];
           [alertView show];

    }
    //一般用的這個代理方法來作 發現鍵盤在popViewControllerAnimated後會從新出現
    -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{code

    if (buttonIndex==1) {
           [self.navigationController popViewControllerAnimated:YES];
       }

    }事件

    //百思不得其姐後,後了下面這個代理方法,居然鍵盤不出現了!
    -(void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
    {it

    if (buttonIndex==1) {
           [self.navigationController popViewControllerAnimated:YES];
       }

    }io

相關文章
相關標籤/搜索