当键盘屏幕出现在屏幕上时,如何移动表格单元格。
提前致谢。
答案 0 :(得分:0)
Check this answer from Xamarin Forums
答案 1 :(得分:0)
这是代码的和平;我在我的申请中使用。可能它可以帮助你。
/*
Function: Registers current class for receiving notification from keyboard
*/
void registerNotification(CGRect bounds)
{
NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.WillShowNotification, keyboardWillShow);
NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.DidShowNotification, keyboardDidShow);
NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.WillHideNotification, keyboardWillHide);
}
void keyboardDidShow(NSNotification notification)
{
}
void keyboardWillShow(NSNotification notification)
{
//TODO: find a scenario for this
CGRect bounds = UIKeyboard.BoundsFromNotification(notification);
moveView(bounds, notification);
}
void keyboardWillHide(NSNotification notification)
{
CGRect bounds = UIKeyboard.BoundsFromNotification(notification);
moveView(bounds, notification);
}
/*
Function: Generic function to move the view along with the keyboard
*/
void moveView(CGRect bounds, NSNotification notification)
{
UIView.BeginAnimations(string.Empty, System.IntPtr.Zero);
UIView.SetAnimationDuration(0.3);
//Your code to Move View
SetNeedsDisplay();
UIView.CommitAnimations();
}