void UpdateHeaderHeight() { if (this.NavigationController == null) { return; } UINavigationBar navigationBar = this.NavigationController.NavigationBar; if (navigationBar.Translucent) { UIApplication app = UIApplication.SharedApplication; bool isLandscape = UIInterfaceOrientationExtensions.IsLandscape(app.StatusBarOrientation); UIUserInterfaceIdiom idiom = UIDevice.CurrentDevice.UserInterfaceIdiom; double version = Double.Parse(UIDevice.CurrentDevice.SystemVersion); if (idiom == UIUserInterfaceIdiom.Pad && version >= 8.0) { this.headerHeight = (float)(navigationBar.IntrinsicContentSize.Height + app.StatusBarFrame.Height); } else { float statusBarSize = (float)app.StatusBarFrame.Size.Height; if (isLandscape) { statusBarSize = (float)app.StatusBarFrame.Size.Width; } this.headerHeight = (float)(navigationBar.IntrinsicContentSize.Height + statusBarSize); } } }
public override void ViewDidLoad() { base.ViewDidLoad(); this.View.BackgroundColor = UIColor.White; UIUserInterfaceIdiom idiom = UIDevice.CurrentDevice.UserInterfaceIdiom; if (options.Count > 0 || sections.Count > 0) { if (idiom == UIUserInterfaceIdiom.Pad) { this.loadIPadLayout(); } else { this.loadIPhoneLayout(); } } else { if (idiom == UIUserInterfaceIdiom.Pad) { exampleBounds = CGRect.Inflate(this.View.Bounds, -30, -30); } else { exampleBounds = CGRect.Inflate(this.View.Bounds, -10, -10); } } }
public DefaultAnimation() { idiom = UIDevice.CurrentDevice.UserInterfaceIdiom; this.AddOption ("Area Series", setupAreaSeries); this.AddOption ("Pie Series", setupPieChart); this.AddOption ("Line Series", setupLineSeries); this.AddOption ("Scatter Series", setupScatterSeries); this.AddOption ("Bar Series", setupBarSeries); this.AddOption ("Column Series", setupColumnSeries); }
public DefaultAnimation() { idiom = UIDevice.CurrentDevice.UserInterfaceIdiom; this.AddOption("Area Series", setupAreaSeries); this.AddOption("Pie Series", setupPieChart); this.AddOption("Line Series", setupLineSeries); this.AddOption("Scatter Series", setupScatterSeries); this.AddOption("Bar Series", setupBarSeries); this.AddOption("Column Series", setupColumnSeries); }
//#pragma mark - Layout. public CGRect MMButtonRectMake(CGRect rect, CGRect contentRect, UIUserInterfaceIdiom interfaceIdiom) { rect.Offset(contentRect.X, contentRect.Y); if (interfaceIdiom == UIUserInterfaceIdiom.Pad) { nfloat inset = MMNumberKeyboardPadSpacing / 2.0f; rect = rect.Inset(inset, inset); } return(rect); }
public CGSize sizeThatFits(CGSize size) { /*const*/ UIUserInterfaceIdiom interfaceIdiom = UI_USER_INTERFACE_IDIOM(); /*const*/ nfloat spacing = (interfaceIdiom == UIUserInterfaceIdiom.Pad) ? MMNumberKeyboardPadBorder : 0.0f; size.Height = MMNumberKeyboardRowHeight * MMNumberKeyboardRows + (spacing * 2.0f); if (size.Width == 0.0f) { size.Width = UIScreen.MainScreen.Bounds.Size.Width; } return(size); }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { Xamarin.Themes.CashflowTheme.Apply(Xamarin.Themes.ColorScheme.Black); UIUserInterfaceIdiom idiom = UIDevice.CurrentDevice.UserInterfaceIdiom; if (idiom == UIUserInterfaceIdiom.Pad) { CustomizeiPadTheme(); } IPhoneInit(); return(true); }
public override void settingsTouched(object sender, EventArgs e) { UIUserInterfaceIdiom idiom = UIDevice.CurrentDevice.UserInterfaceIdiom; if (idiom == UIUserInterfaceIdiom.Pad) { if (this.Popover != null && this.Popover.PopoverVisible) { this.Popover.Dismiss(true); return; } this.Popover = new UIPopoverController(settings); CGRect settingBounds = settings.View.Bounds; this.Popover.PopoverContentSize = new CGSize(320, settingBounds.Height); this.Popover.PresentFromBarButtonItem(this.SettingsButton, UIPopoverArrowDirection.Up, true); } else { this.NavigationController.PushViewController(settings, true); } }
public override void ViewDidLoad() { base.ViewDidLoad(); this.View.BackgroundColor = UIColor.White; this.UpdateHeaderHeight(); UIUserInterfaceIdiom idiom = UIDevice.CurrentDevice.UserInterfaceIdiom; if (options.Count > 0 || sections.Count > 0) { if (idiom == UIUserInterfaceIdiom.Pad) { this.loadIPadLayout(); } else { this.loadIPhoneLayout(); } } this.UpdateLayoutConstraints(); }
public virtual void settingsTouched(object sender, EventArgs e) { SettingsViewController settings = new SettingsViewController(this); UIUserInterfaceIdiom idiom = UIDevice.CurrentDevice.UserInterfaceIdiom; if (idiom == UIUserInterfaceIdiom.Pad) { if (popover != null && popover.PopoverVisible) { popover.Dismiss(true); return; } popover = new UIPopoverController(settings); CGRect settingsRect = settings.View.Bounds; settings.Table.SizeToFit(); popover.PopoverContentSize = new CGSize((float)(Math.Min(settingsRect.Size.Width, settingsRect.Size.Height) / 2.0), settings.Table.ContentSize.Height); popover.PresentFromBarButtonItem(settingsButton, UIPopoverArrowDirection.Up, true); } else { this.NavigationController.PushViewController(settings, true); } }
void UpdateLayoutConstraints() { this.exampleBounds = this.View.Bounds; this.UpdateHeaderHeight(); this.exampleBounds.Y += this.headerHeight; this.exampleBounds.Height -= this.headerHeight; if (this.offset > 0) { this.exampleBounds.Y += this.offset; this.exampleBounds.Height -= this.offset; } UIUserInterfaceIdiom idiom = UIDevice.CurrentDevice.UserInterfaceIdiom; if (idiom == UIUserInterfaceIdiom.Pad) { exampleBounds = CGRect.Inflate(this.exampleBounds, -30, -30); } else { exampleBounds = CGRect.Inflate(this.exampleBounds, -10, -10); } }
static DimensionSet() { _idiom = UIDevice.CurrentDevice.UserInterfaceIdiom; }
static DimensionSet() { _idiom = UIDevice.CurrentDevice.UserInterfaceIdiom; }
//#pragma mark - Layout. public CGRect MMButtonRectMake(CGRect rect, CGRect contentRect, UIUserInterfaceIdiom interfaceIdiom){ rect.Offset( contentRect.X, contentRect.Y); if (interfaceIdiom == UIUserInterfaceIdiom.Pad) { nfloat inset = MMNumberKeyboardPadSpacing / 2.0f; rect = rect.Inset( inset, inset); } return rect; }
public ExportRendererAttribute(Type handler, Type target, UIUserInterfaceIdiom idiom) : base(handler, target) { Idiomatic = true; Idiom = idiom; }
public ExportRendererAttribute(Type handler, Type target, UIUserInterfaceIdiom idiom) : this(handler, target, idiom, null) { }
public ExportRendererAttribute(Type handler, Type target, UIUserInterfaceIdiom idiom, Type[] supportedVisuals) : base(handler, target, supportedVisuals) { Idiomatic = true; Idiom = idiom; }
public _MMNumberKeyboardButton(/*keyboardButtonWithType*/ MMNumberKeyboardButtonType buttonType) { //_MMNumberKeyboardButton button = new _MMNumberKeyboardButton(MMNumberKeyboardButtonType.Done); /*const*/ UIUserInterfaceIdiom interfaceIdiom = UI_USER_INTERFACE_IDIOM(); UIColor fillColor = null; UIColor highlightedFillColor = null; if (buttonType == MMNumberKeyboardButtonType.White) { fillColor = UIColor.White; highlightedFillColor = UIColor.FromRGBA(0.82f, /*green*/ 0.837f, /*blue*/ 0.863f, /*alpha*/ 1f); } else if (buttonType == MMNumberKeyboardButtonType.Gray) { if (interfaceIdiom == UIUserInterfaceIdiom.Pad) { fillColor = UIColor.FromRGBA(0.674f, /*green*/ 0.7f, /*blue*/ 0.744f, /*alpha*/ 1f); } else { fillColor = UIColor.FromRGBA(0.81f, /*green*/ 0.837f, /*blue*/ 0.86f, /*alpha*/ 1f); } highlightedFillColor = UIColor.White; } else if (buttonType == MMNumberKeyboardButtonType.Done) { fillColor = UIColor.FromRGBA(0f, /*green*/ 0.479f, /*blue*/ 1f, /*alpha*/ 1f); highlightedFillColor = UIColor.White; } UIColor controlColor = null; UIColor highlightedControlColor = null; if (buttonType == MMNumberKeyboardButtonType.Done) { controlColor = UIColor.White; highlightedControlColor = UIColor.Black; } else { controlColor = UIColor.Black; highlightedControlColor = UIColor.Black; } this.SetTitleColor(controlColor, /*forState*/ UIControlState.Normal); this.SetTitleColor(highlightedControlColor, /*forState*/ UIControlState.Selected); this.SetTitleColor(highlightedControlColor, /*forState*/ UIControlState.Highlighted); this.fillColor = fillColor; this.highlightedFillColor = highlightedFillColor; this.controlColor = controlColor; this.highlightedControlColor = highlightedControlColor; if (interfaceIdiom == UIUserInterfaceIdiom.Pad) { CALayer buttonLayer = this.Layer; buttonLayer.CornerRadius = 4.0f; buttonLayer.ShadowColor = UIColor.FromRGBA(0.533f, /*green*/ 0.541f, /*blue*/ 0.556f, /*alpha*/ 1f).CGColor; buttonLayer.ShadowOffset = new CGSize(0f, 1.0f); buttonLayer.ShadowOpacity = 1.0f; buttonLayer.ShadowRadius = 0.0f; } //return button; }
public override void LayoutSubviews() { base.LayoutSubviews(); CGRect bounds = new CGRect() { Size = this.Bounds.Size }; NSDictionary buttonDictionary = this.buttonDictionary; // Settings. /*const*/ UIUserInterfaceIdiom interfaceIdiom = UI_USER_INTERFACE_IDIOM(); /*const*/ nfloat spacing = (interfaceIdiom == UIUserInterfaceIdiom.Pad) ? MMNumberKeyboardPadBorder : 0.0f; /*const*/ nfloat maximumWidth = (interfaceIdiom == UIUserInterfaceIdiom.Pad) ? (nfloat)400.0 : bounds.Width; /*const*/ bool allowsDecimalPoint = this.allowsDecimalPoint; /*const*/ nfloat width = (nfloat)Math.Min(maximumWidth, bounds.Width); /*const*/ CGRect contentRect = new CGRect() { X = (nfloat)Math.Round((bounds.Width - width) / (nfloat)2.0f), Y = spacing, Size = new CGSize() { Width = width, Height = bounds.Height - spacing * 2.0f } }; // Layout. /*const*/ nfloat columnWidth = contentRect.Width / 4.0f; /*const*/ nfloat rowHeight = MMNumberKeyboardRowHeight; CGSize numberSize = new CGSize(columnWidth, rowHeight); // Layout numbers. /*const*/ MMNumberKeyboardButton numberMin = MMNumberKeyboardButton.NumberMin; /*const*/ MMNumberKeyboardButton numberMax = MMNumberKeyboardButton.NumberMax; /*const*/ nint numbersPerLine = 3; for (MMNumberKeyboardButton key = numberMin; key < numberMax; key++) { UIButton button = (UIButton)buttonDictionary["" + key]; nint digit = key - numberMin; CGRect rect = new CGRect() { Size = numberSize }; if (digit == 0f) { rect.Y = numberSize.Height * 3f; rect.X = numberSize.Width; if (!allowsDecimalPoint) { rect.Size = new CGSize() { Width = numberSize.Width * 2.0f }; button.ContentEdgeInsets = new UIEdgeInsets(0f, 0f, 0f, numberSize.Width); } } else { nint idx = (digit - 1); nint line = idx / numbersPerLine; nint pos = idx % numbersPerLine; rect.Y = line * numberSize.Height; rect.X = pos * numberSize.Width; } button.Frame = MMButtonRectMake(rect, contentRect, interfaceIdiom); } // Layout special key. UIButton specialKey = (UIButton)buttonDictionary["" + MMNumberKeyboardButton.Special]; if (specialKey != null) { CGRect rect = new CGRect() { Size = numberSize }; rect.Y = numberSize.Height * 3f; specialKey.Frame = MMButtonRectMake(rect, contentRect, interfaceIdiom); } // Layout decimal point. UIButton decimalPointKey = (UIButton)buttonDictionary["" + MMNumberKeyboardButton.DecimalPoint]; if (decimalPointKey != null) { CGRect rect = new CGRect() { Size = numberSize }; rect.Y = numberSize.Height * 3f; rect.X = numberSize.Width * 2f; decimalPointKey.Frame = MMButtonRectMake(rect, contentRect, interfaceIdiom); decimalPointKey.Hidden = !allowsDecimalPoint; } // Layout utility column. /*const*/ MMNumberKeyboardButton [] utilityButtonKeys = new MMNumberKeyboardButton[] { MMNumberKeyboardButton.Backspace, MMNumberKeyboardButton.Done }; /*const*/ CGSize utilitySize = new CGSize(columnWidth, rowHeight * 2.0f); for (nint idx = 0; idx < utilityButtonKeys.Length; idx++) { MMNumberKeyboardButton key = utilityButtonKeys[idx]; UIButton button = (UIButton)buttonDictionary["" + key]; CGRect rect = new CGRect() { Size = utilitySize }; rect.X = columnWidth * 3.0f; rect.Y = idx * utilitySize.Height; button.Frame = MMButtonRectMake(rect, contentRect, interfaceIdiom); } // Layout separators if phone. if (interfaceIdiom != UIUserInterfaceIdiom.Pad) { NSArray separatorViews = this.separatorViews; /*const*/ nuint totalColumns = 4; /*const*/ nuint totalRows = (nuint)numbersPerLine + 1; /*const*/ nuint numberOfSeparators = totalColumns * totalRows - 1; if (separatorViews.Count != numberOfSeparators) { separatorViews.PerformSelector(new Selector("makeObjectsPerformSelector"), NSObject.FromObject(new Selector("removeFromSuperview"))); NSMutableArray neueSeparatorViews = new NSMutableArray(numberOfSeparators); for (nuint idx = 0; idx < numberOfSeparators; idx++) { UIView separator = new UIView(CGRect.Empty); separator.BackgroundColor = UIColor.FromWhiteAlpha(0.0f, /*alpha*/ 0.1f); this.AddSubview(separator); neueSeparatorViews.Add(separator); } this.separatorViews = neueSeparatorViews; } /*const*/ nfloat separatorDimension = 1.0f / ((this.Window.Screen.Scale != 0) ? this.Window.Screen.Scale: 1.0f); separatorViews.enumerateObjectsUsingBlock((object obj, nuint idx, out bool stop) => { UIView separator = (UIView)obj; CGRect rect = CGRect.Empty; if (idx < totalRows) { rect.Y = idx * rowHeight; if (idx % 2 != 0) { rect.Size = new CGSize(rect.Size) { Width = contentRect.Width - columnWidth }; } else { rect.Size = new CGSize(rect.Size) { Width = contentRect.Width }; } rect.Size = new CGSize(rect.Size) { Height = separatorDimension }; } else { nuint col = (idx - totalRows); rect.X = (col + 1) * columnWidth; rect.Size = new CGSize(rect.Size) { Width = separatorDimension }; if (col == 1 && !allowsDecimalPoint) { rect.Size = new CGSize(rect.Size) { Height = contentRect.Height - rowHeight }; } else { rect.Size = new CGSize(rect.Size) { Height = contentRect.Height }; } } separator.Frame = MMButtonRectMake(rect, contentRect, interfaceIdiom); stop = false; }); } }
public ExportRendererAttribute(Type handler, Type target, UIUserInterfaceIdiom idiom) : base(handler, target) { Idiomatic = true; Idiom = idiom; }
public UITraitCollection(UIUserInterfaceIdiom userInterfaceIdiom) { }