करने के लिए रूपांतरण मैं सी # करने के लिए कोड के इस टुकड़े कन्वर्ट करने के लिए कोशिश कर रहा हूँ, कोड से है एप्पल के documentationObj सी से सी #
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];
अब तक यह मेरा प्रयास, मैं 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);
}
मैं शायद सही प्रकार का उपयोग नहीं कर रहा हूं, क्या कोई मेरी मदद कर सकता है, या कुछ वैकल्पिक कोड समान काम कर सकता है। धन्यवाद
मुझे यकीन नहीं है कि "मैं CGRectValue पर अटक गया हूं" का क्या मतलब है। क्या डीबगर दिखाता है कि पहले से निर्दिष्ट चर के सभी मानों की अपेक्षा की जाती है? ARect = self.view.frame के बाद aRect के बारे में डीबगर क्या दिखाता है? –
मैं उस लाइन को सी # कोड में परिवर्तित नहीं कर सकता। यह संकलित नहीं करता है। कृपया मैंने कोशिश की सी # कोड देखें। –
आप '_currentField' कैसे प्राप्त करते हैं? मैं ट्यूटोरियल को भी परिवर्तित कर रहा हूं * [आईओएस एसडीके: कुंजीपटल के नीचे से सामग्री को रखना] (http://code.tutsplus.com/tutorials/ios-sdk-keeping-content-from-underneath-the-keyboard-- मोबाइल -6103) * ... – testing