Я хочу увидеть все мое представление, но когда появляется клавиатура, я не вижу все, например:
-------------------------------------------
- --------------------------------------- - i want what my viewcontroller have scroll
- - text field 1 - -
- - text field 2 - -
- - text field n - -
- ------------------------------------- - -
-------------------------------------------
- -
- keyboard -
- -
- - - -
- ------------------------------------- - -
Это мой код, с помощью этого кода я могу исправить в одном из моего текстового поля , я использую этот IsFirstResponder для того, что я могу видеть текущее текстовое поле, но я хочу видеть все мои текстовые поля, я могу поставить прокрутку?:
возможно поставить прокрутку? Я проверил много приложений, и я думаю, что это возможно.
public static void KeyBoardUpNotification(NSNotification notification)
{
scrollamount = 0.0f;
RectangleF rectangle = (RectangleF)UIKeyboard.BoundsFromNotification(notification);
bottom = ((float)(activeview.Frame.Y + activeview.Frame.Height + offset));
scrollamount = ((float)(rectangle.Height - (currentView.Frame.Size.Height - bottom)));
if (scrollamount != 0)
{
moveViewUp = true;
ScrollTheView(moveViewUp);
}
else
{
moveViewUp = false;
}
}
public static void KeyBoardDownNotification(NSNotification notification)
{
if (moveViewUp) ScrollTheView(false);
}
private static void ScrollTheView(bool move)
{
UIView.BeginAnimations(string.Empty, IntPtr.Zero);
UIView.SetAnimationDuration(0.3);
RectangleF frame = (RectangleF)currentView.Frame;
if (move)
{
frame.Y = y;
frame.Y -= scrollamount;
}
else
{
frame.Y = y;
scrollamount = 0;
moveViewUp = false;
}
currentView.Frame = frame;
UIView.CommitAnimations();
scrollamount = 0;
frame.Y = 0;