NSScrollView SetupTableView() { _tableView = new GridTableView(Title, Self); AddTableColumns(_tableView); NSProcessInfo info = new NSProcessInfo(); if (info.IsOperatingSystemAtLeastVersion(new NSOperatingSystemVersion(10, 13, 0))) { _tableView.UsesAutomaticRowHeights = true; // only available in OSX 13 and above.AddTableColumns(_tableView); } var scrollView = new NSScrollView { DocumentView = _tableView, HasVerticalScroller = true, HasHorizontalScroller = true, AutohidesScrollers = true, WantsLayer = true, Layer = new CALayer { Bounds = new CGRect(0, 0, 0, 0) }, Bounds = new CGRect(0, 0, 0, 0) }; scrollView.ContentView.AutoresizingMask = NSViewResizingMask.HeightSizable | NSViewResizingMask.WidthSizable; scrollView.ContentView.AutoresizesSubviews = true; scrollView.ScrollRectToVisible(new CGRect(0, 0, 0, 0)); return(scrollView); }
private void CreateLaContext() { var info = new NSProcessInfo(); #if __MAC__ var minVersion = new NSOperatingSystemVersion(10, 12, 0); if (!info.IsOperatingSystemAtLeastVersion(minVersion)) { return; } #else if (!UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { return; } #endif // Check LAContext is not available on iOS7 and below, so check LAContext after checking iOS version. if (Class.GetHandle(typeof(LAContext)) == IntPtr.Zero) { return; } _context = new LAContext(); }
public NSScrollView SetupView() { _printView = new GridTableView("PrintView", Self); AddTableColumns(_printView); NSProcessInfo info = new NSProcessInfo(); if (info.IsOperatingSystemAtLeastVersion(new NSOperatingSystemVersion(10, 13, 0))) { _printView.UsesAutomaticRowHeights = true; // only available in OSX 13 and above. } var scrollView = new NSScrollView { DocumentView = _printView, HasVerticalScroller = false, HasHorizontalScroller = false, WantsLayer = true, Layer = NewLayer(), Bounds = new CGRect(0, 0, 0, 0) }; scrollView.ContentView.AutoresizingMask = NSViewResizingMask.HeightSizable | NSViewResizingMask.WidthSizable; scrollView.ContentView.AutoresizesSubviews = true; return(scrollView); }
internal static bool HasOSVersion(int major, int minor) { using var info = new NSProcessInfo(); return(info.IsOperatingSystemAtLeastVersion(new NSOperatingSystemVersion(major, minor, 0))); }