sto cercando di convertire questo pezzo di codice in C#, il codice è da Apple documentationLa conversione da 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];
Finora questo è il mio tentativo, io sono sempre attaccato alla 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);
}
non sto usando probabilmente il tipo giusto, qualcuno può darmi una mano, o un po 'di codice alternativo fare cosa simile. Grazie
Non sono sicuro di cosa intendi per "Mi sto bloccando al CGRectValue". Il debugger mostra che tutte le variabili precedentemente riferite hanno i valori che ti aspetteresti? Cosa mostra il debugger su aRect dopo aRect = self.view.frame? –
Non riesco a convertire quella linea in codice C#. Non viene compilato. Si prega di consultare il codice C# che ho provato. –
Come si ottiene '_currentField'? Sto anche convertendo il tutorial * [iOS SDK: Keeping Content From Underneath the Keyboard] (http://code.tutsplus.com/tutorials/ios-sdk-keeping-content-from-underneath-the-keyboard--mobile -6103) * ... – testing