public override IEnumerable <KeyValuePair <string, object> > GetAvailableFamilyFaces(string family) { foreach (var nsFace in NSFontManager.SharedFontManager.AvailableMembersOfFontFamily(family)) { var name = NSString.FromHandle(nsFace.ValueAt(1)); var weight = ((NSNumber)NSValue.ValueFromPointer(nsFace.ValueAt(2)).NonretainedObjectValue).Int32Value; var traits = (NSFontTraitMask)((NSNumber)NSValue.ValueFromPointer(nsFace.ValueAt(3)).NonretainedObjectValue).Int32Value; yield return(new KeyValuePair <string, object>(name, FontData.FromFamily(family, traits, weight, 0))); } yield break; }
public static void StartConversation(Entity playerEntity, Entity characterEntity, ConversationItem[] conversation, int id) { var handle = (IntPtr)GCHandle.Alloc(conversation); var conversationValue = NSValue.ValueFromPointer(handle); NSDictionary userInfo = new NSDictionary((NSString)CharacterEntityKey, characterEntity, (NSString)PlayerEntityKey, playerEntity, ConversationIdKey, new NSNumber(id), ConversationKey, conversationValue); var nc = NSNotificationCenter.DefaultCenter; nc.PostNotificationName(RunConversationNotification, characterEntity, userInfo); }
private void OnKeyboardWillShow(NSNotification notification) { keyboardVisible = true; NSObject value = null; notification.UserInfo.TryGetValue(UIKeyboard.BoundsUserInfoKey, out value); if (value == null) { return; } var responder = ScrollView.GetSubview <UIView>(v => v.IsFirstResponder); if (responder == null) { return; } var nsvalue = NSValue.ValueFromPointer(value.Handle); var kbFrame = nsvalue.RectangleFValue; var insets = ScrollView.ContentInset; insets.Bottom = kbFrame.Height; if (!UIDevice.CurrentDevice.CheckSystemVersion(7, 0)) { var tabController = ScrollView.GetSuperview <UITabBarController>(); if (tabController != null) { insets.Bottom -= tabController.TabBar.Frame.Height; } } ScrollView.ContentInset = insets; ScrollView.ScrollIndicatorInsets = ScrollView.ContentInset; nfloat y = ScrollView.Frame.Height - ScrollView.ContentInset.Bottom - responder.Frame.Height; var frame = ScrollView.ConvertRectFromView(responder.Bounds, responder); if (frame.Y + 10 > ScrollView.ContentOffset.Y + y) { ScrollView.SetContentOffset(new CGPoint(ScrollView.ContentOffset.X, frame.Y - y + 10), true); } else if (frame.Y - 10 < ScrollView.ContentOffset.Y + ScrollView.ContentInset.Top) { ScrollView.SetContentOffset(new CGPoint(ScrollView.ContentOffset.X, NMath.Max(frame.Y - ScrollView.ContentInset.Top - 10, -ScrollView.ContentInset.Top)), true); } }