public override void Draw(CoreGraphics.CGRect rect) { if (TraitCollection.Contains(UITraitCollection.FromHorizontalSizeClass(UIUserInterfaceSizeClass.Compact))) { Font = UIFont.FromName("robotastic", 27f); } else { if (TraitCollection.Contains(UITraitCollection.FromHorizontalSizeClass(UIUserInterfaceSizeClass.Regular)) && TraitCollection.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone) { Font = UIFont.FromName("robotastic", 30f); } else { Font = UIFont.FromName("robotastic", 42f); } } if (Focused) { SetBackgroundImage(UIImage.FromFile("Images/BOL-GREEN.png"), UIControlState.Normal); } else { SetBackgroundImage(UIImage.FromFile("Images/BOL-WHITE.png"), UIControlState.Normal); } base.Draw(rect); }
public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator) { if (toSize.Width > 320.0f) { ForcedTraitCollection = UITraitCollection.FromHorizontalSizeClass(UIUserInterfaceSizeClass.Regular); } else { ForcedTraitCollection = new UITraitCollection(); } base.ViewWillTransitionToSize(toSize, coordinator); }
public override void TraitCollectionDidChange(UITraitCollection previousTraitCollection) { if (TraitCollection.Contains(UITraitCollection.FromHorizontalSizeClass(UIUserInterfaceSizeClass.Compact))) { if (regularConstraints [0].Active) { NSLayoutConstraint.DeactivateConstraints(regularConstraints); NSLayoutConstraint.ActivateConstraints(compactConstraints); } } else { if (compactConstraints [0].Active) { NSLayoutConstraint.DeactivateConstraints(compactConstraints); NSLayoutConstraint.ActivateConstraints(regularConstraints); } } }