estoy tratando de convertir esta pieza de código para C#, el código es de Apple documentationLa conversión de Obj C a C#
NSDictionary* info = [aNotification userInfo];
CGSize kbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
UIEdgeInsets contentInsets = UIEdgeInsetsMake(0.0, 0.0, kbSize.height, 0.0);
scrollView.contentInset = contentInsets;
scrollView.scrollIndicatorInsets = contentInsets;
CGRect aRect = self.view.frame;
aRect.size.height -= kbSize.height;
if (!CGRectContainsPoint(aRect, activeField.frame.origin)) {
CGPoint scrollPoint = CGPointMake(0.0, activeField.frame.origin.y-kbSize.height);
[scrollView setContentOffset:scrollPoint animated:YES];
Hasta ahora, este es mi intento, me queda pegada en el CGRectValue.
NSDictionary info = n.UserInfo;
SizeF kbSize = ((RectangleF)info[UIKeyboard.FrameBeginUserInfoKey]).Size;
UIEdgeInsets contentInsets = new UIEdgeInsets(0.0f, 0.0f, kbSize.Height, 0.0f);
this.uiScrollView.ContentInset = contentInsets;
this.uiScrollView.ScrollIndicatorInsets = contentInsets;
RectangleF aRect = this.View.Frame;
aRect.Size.Height -= kbSize.Height;
if(!aRect.Contains(_currentField.Frame))
{
PointF scrollPoint = new PointF(0.0f, _currentField.Frame.Y - kbSize.Height);
this.uiScrollView.SetContentOffset(scrollPoint, true);
}
Probablemente no estoy usando el tipo correcto, alguien puede ayudarme, o algún código alternativo haciendo algo similar. Gracias
No estoy seguro de lo que quiere decir con "Me estoy atascado en CGRectValue". ¿El depurador muestra que todas las variables referidas anteriormente tienen los valores que esperarías? ¿Qué muestra el depurador sobre aRect after aRect = self.view.frame? –
No puedo convertir esa línea al código C#. No compila Por favor, mira el código de C# que probé. –
¿Cómo se obtiene '_currentField'? También estoy convirtiendo el tutorial * [iOS SDK: mantener el contenido debajo del teclado] (http://code.tutsplus.com/tutorials/ios-sdk-keeping-content-from-underneath-the-keyboard--mobile -6103) * ... – testing