텍스트 상자가 키보드로 덮여있는 경우보기를 스크롤하는 위치에 약간의 코드가 있습니다. 콜백 메서드가 'KeyboardWillShow'인 Xamarin의 개발자 가이드에있는 'UIKeyboard.Notifications.ObserveWillShow'예제에 표시된대로 메서드 스타일을 사용하고 있습니다. 여기 내 구현입니다.UIKeyboardEventArgs FrameBegin 첫 번째 클릭 후 높이가 0을 반환합니다.
public void KeyboardWillShow(UIKeyboardEventArgs KeyboardArgs, UIView uiResponderView)
{
if (ScrollView != null)
{
if (uiResponderView != null)
{
UIEdgeInsets contentInsets = new UIEdgeInsets(0.0f, 0.0f, KeyboardArgs.FrameBegin.Height, 0.0f);
ScrollView.ContentInset = contentInsets;
ScrollView.ScrollIndicatorInsets = contentInsets;
CGRect tableViewRect = ScrollView.Frame;
tableViewRect.Height -= KeyboardArgs.FrameBegin.Height;
if (!tableViewRect.Contains(uiResponderView.Frame.Location))
{
ScrollView.ScrollRectToVisible(uiResponderView.Frame, true);
}
}
}
}
또한 키보드가 콜백 방법은 'KeyboardWillHide'는 자 마린의 개발자 가이드의 'UIKeyboard.Notifications.ObserveWillHide'예제를 사용하여 숨기는 경우에 대해 듣고있어. 여기 그것에 대한 나의 구현이있다.
public void KeyBoardWillHide(object sender, UIKeyboardEventArgs args)
{
ScrollView.ContentInset = UIEdgeInsets.Zero;
ScrollView.ScrollIndicatorInsets = UIEdgeInsets.Zero;
}
이 모든없이 문제를 처음 작동하지만 이후의 모든 시간 "KeyboardArgs.FrameBegin.Height는"0 누군가가 나에게 내가 부족 무엇인지 알려 주시기 바랍니다 수 반환?
편집 : "ViewWillDisappear"에서 관찰자를 처분합니다.
해결
: 케빈의 노트를 바탕으로 , 나는 대신 'KeyboardArgs.FrameBegin.Height'의 'KeyboardArgs.FrameEnd.Height'을 사용하려면 내 'KeyboardWillShow'이벤트를 변경하고 프로세스가 문제없이 작동합니다. 이 행사는 지금과 같이 보인다 :public void KeyboardWillShow(UIKeyboardEventArgs KeyboardArgs, UIView uiResponderView)
{
if (ScrollView != null)
{
if (uiResponderView != null)
{
UIEdgeInsets contentInsets = new UIEdgeInsets(0.0f, 0.0f, KeyboardArgs.FrameEnd.Height, 0.0f);
ScrollView.ContentInset = contentInsets;
ScrollView.ScrollIndicatorInsets = contentInsets;
CGRect tableViewRect = ScrollView.Frame;
tableViewRect.Height -= KeyboardArgs.FrameEnd.Height;
if (!tableViewRect.Contains(uiResponderView.Frame.Location))
{
ScrollView.ScrollRectToVisible(uiResponderView.Frame, true);
}
}
}
}