public void SimpleValuesSet() { var sa = new CTStringAttributes(); sa.ForegroundColor = UIColor.Blue.CGColor; sa.Font = new CTFont("Georgia-BoldItalic", 24); sa.UnderlineStyle = CTUnderlineStyle.Double; // It does not seem to do anything sa.UnderlineColor = UIColor.Blue.CGColor; sa.UnderlineStyleModifiers = CTUnderlineStyleModifiers.PatternDashDotDot; Assert.IsNull(sa.BaselineClass, "#0"); sa.BaselineClass = CTBaselineClass.IdeographicHigh; Assert.AreEqual(CTBaselineClass.IdeographicHigh, sa.BaselineClass, "#1"); sa.SetBaselineInfo(CTBaselineClass.Roman, 13); sa.SetBaselineInfo(CTBaselineClass.IdeographicHigh, 3); sa.SetWritingDirection(CTWritingDirection.LeftToRight); var size = new SizeF(300, 300); UIGraphics.BeginImageContext(size); var gctx = UIGraphics.GetCurrentContext(); gctx.SetFillColor(UIColor.Green.CGColor); var attributedString = new NSAttributedString("Test_ME~`", sa); using (var textLine = new CTLine(attributedString)) { textLine.Draw(gctx); } UIGraphics.EndImageContext(); }
public override CoreGraphics.CGSize SizeThatFits(CoreGraphics.CGSize size) { var bounds = Frame.Size; bounds.Height = CarStyle.RowHeight; return(bounds); }
public void CGImageBackend() { string file = Path.Combine(NSBundle.MainBundle.ResourcePath, "basn3p08.png"); using (var original = UIImage.FromFile(file)) { Assert.That(original.CGImage.Width, Is.EqualTo((nint)32), "Width-a"); Assert.That(original.CGImage.Height, Is.EqualTo((nint)32), "Height-a"); SizeF half = new SizeF(16f, 16f); IntPtr handle = original.CGImage.Handle; using (var resized = original.Scale(half)) { Assert.That(resized.CGImage.Height, Is.EqualTo(resized.CGImage.Width), "Width-Height-identical"); // caching of the backing CGImage occurs on devices (but not always) if (Runtime.Arch == Arch.SIMULATOR) { Assert.That((nint)16, Is.EqualTo(resized.CGImage.Width), "half"); } else { var h = resized.CGImage.Height; Assert.True(h == 16 || h == 32, "mostly"); } Assert.That(handle, Is.Not.EqualTo(resized.CGImage.Handle), "Handle"); } } }
public override void ResizeSubviewsWithOldSize(CoreGraphics.CGSize oldSize) { base.ResizeSubviewsWithOldSize(oldSize); var bounds = Bounds; var frame = bounds; frame.Width = ImageWidth + TwicePadding; ImageView.Frame = new CoreGraphics.CGRect(Padding, (frame.Height - ImageWidth) / 2, ImageWidth, ImageWidth); var x = frame.Right + Padding; var offIconW = NMath.Min(offlineIconWidth, OfflineImageView.Frame.Width); var right = bounds.Right; var width = right - x - offIconW; frame.Width = width; frame.X = x; TextView.Frame = frame; x = frame.Right; frame.Width = bounds.Width - frame.Right; frame.X = x; //OfflineImageView.Center = frame.GetCenter (); //MediaTypeImage.Frame = new CGRect (aLeft + Padding, bounds.Height - offlineIconWidth - Padding, offlineIconWidth, offlineIconWidth); }
public override async void SetFrameSize(CoreGraphics.CGSize newSize) { base.SetFrameSize(newSize); if (Application.HasCurrent) { NSOpenGLContext.CurrentContext?.Update(); } }
public MyScrollView() { content1 = new UIView(); content2 = new UIView(); content3 = new UIView(); containerView = new UIView(); scrollView = new UIScrollView(); contentViewSize = new CoreGraphics.CGSize(View.Frame.Width, View.Frame.Height + 800); }
public void ViewWillTransitionToSize(CoreGraphics.CGSize toSize, IUIViewControllerTransitionCoordinator coordinator) { var deviceOrientation = UIDevice.CurrentDevice.Orientation; if (deviceOrientation.IsPortrait() || deviceOrientation.IsLandscape()) { VideoPreviewLayer.Connection.VideoOrientation = (AVCaptureVideoOrientation)deviceOrientation; } }
async void ITest.Test(Label element) { var uiLabel = (UILabel)await element.On <Xamarin.Forms.PlatformConfiguration.iOS>().iOSAsync(); uiLabel.Text = "Changed Label via UILabel"; CoreGraphics.CGSize cgSize = new CoreGraphics.CGSize(); uiLabel.ShadowColor = UIColor.Blue; uiLabel.Layer.ShadowOffset = new CGSize(5, 5); uiLabel.Layer.ShadowOpacity = 1.0f; }
public override void Draw(RectangleF rect) { using (var context = UIGraphics.GetCurrentContext()) { _colorToRenderer.SetFill(); context.FillRect(rect); } base.Draw(rect); _previousSize = Bounds.Size; }
public void WidgetActiveDisplayModeDidChange(NCWidgetDisplayMode activeDisplayMode, CoreGraphics.CGSize maxSize) { if (activeDisplayMode == NCWidgetDisplayMode.Compact) { PreferredContentSize = maxSize; } else { PreferredContentSize = _tableView.ContentSize; } }
public override void ResizeSubviewsWithOldSize(CoreGraphics.CGSize oldSize) { base.ResizeSubviewsWithOldSize(oldSize); var bounds = Bounds; blur.Frame = bounds; var sliderCount = sliders.Count; var width = this.Bounds.Width / (sliderCount + 1); var padding = width / 2; var right = Bounds.Width - sidePadding; var sliderTop = 100; var available = bounds.Bottom - sliderTop - (topItemsPadding * 2) - 25; nfloat height = 0; //if (Util.IsIphone) height = NMath.Min(available, EqSliderMaxHeight); //else // height = this.Bounds.Height - 65; var sliderH = sliderTop + ((available - height) / 2) + topItemsPadding; nfloat x; // var offset = width * 2; // preAmp.Frame = new CGRect (padding, sliderH, width, height); // preampLabel.Frame = new CGRect(padding, preAmp.Frame.Bottom, width, 25); for (int i = 0; i < sliders.Count; i++) { x = width * i + padding; var slider = sliders[i]; var label = sliderLabels[i]; slider.Frame = new CGRect(x, sliderH, width, height); label.Frame = new CGRect(x, slider.Frame.Bottom, width, 25); } var frame = enabledSwitch.Frame; frame.X = padding + (frame.Width - width) / 2; frame.Y = sliderH - topItemsPadding - frame.Height; enabledSwitch.Frame = frame; x = frame.Right + padding; comboBox.SizeToFit(); frame = comboBox.Frame; frame.Width = 300; frame.X = x; frame.Y = sliderH - topItemsPadding - frame.Height; comboBox.Frame = frame; }
public override void ResizeSubviewsWithOldSize(CoreGraphics.CGSize oldSize) { base.ResizeSubviewsWithOldSize(oldSize); slider.Frame = Bounds; var frame = Bounds; frame.Height = 2f; backgroundProgress.Frame = frame; frame.Width *= DownloadProgress; // frame.Height = 3f; downloadProgress.Frame = frame; }
public override void ResizeSubviewsWithOldSize(CoreGraphics.CGSize oldSize) { base.ResizeSubviewsWithOldSize(oldSize); var bounds = Bounds; var frame = Toolbar.Frame; frame.Width = bounds.Width; Toolbar.Frame = frame; frame.Y = frame.Bottom; frame.Height = bounds.Height - frame.Y; MainContentView.Frame = frame; }
public override void ResizeSubviewsWithOldSize(CoreGraphics.CGSize oldSize) { base.ResizeSubviewsWithOldSize(oldSize); var bounds = Bounds; var frame = new CGRect(0, 0, bounds.Width, bounds.Width); ImageView.Frame = frame; var y = frame.Bottom; var height = bounds.Height - y; frame.Y = y; frame.Height = height; frame.Width = bounds.Width; Label.Frame = frame; }
public override void ViewDidLayoutSubviews() { base.ViewDidLayoutSubviews(); var size = View.Bounds.Size; if (lastSize == size) { return; } if (menuButton != null) { menuButton.Image = Images.GetMenuImage(size.Width * CarStyle.NavIconImagePercent); } lastSize = size; TableView.RowHeight = CarStyle.RowHeight * .75f; }
private NSData CreatePdfFile(UIViewPrintFormatter printFormatter) { var renderer = new UIPrintPageRenderer(); renderer.AddPrintFormatter(printFormatter, 0); var point = new CoreGraphics.CGPoint(0, 0); var paperSize = new CoreGraphics.CGSize(this.Frame.Size.Width, this.Frame.Size.Height); var printableRect = new CoreGraphics.CGRect(point, new CoreGraphics.CGSize(paperSize.Width, paperSize.Height)); var paperRect = new CoreGraphics.CGRect(point, new CoreGraphics.CGSize(paperSize.Width, paperSize.Height)); renderer.SetValueForKey(NSValue.FromCGRect(paperRect), new NSString("paperRect")); renderer.SetValueForKey(NSValue.FromCGRect(printableRect), new NSString("printableRect")); return(renderer.PrintToPDF(paperRect)); }
public override SizeF SizeThatFits(SizeF size) { var result = base.SizeThatFits(size); var height = result.Height; if (height == 0) { if (System.nfloat.IsInfinity(size.Height)) { height = 5; } else { height = size.Height; } } return(new SizeF(10, height)); }
public override CoreGraphics.CGSize SizeThatFits(CoreGraphics.CGSize size) { if (nfloat.IsInfinity(size.Width)) { size.Width = (nfloat)(Element?.Parent is VisualElement parent ? parent.Width : DeviceDisplay.MainDisplayInfo.GetScaledScreenSize().Width); } var sizeThatFits = Control.SizeThatFits(size); if (Forms.IsiOS11OrNewer) { return(sizeThatFits); } ////iOS10 hack because SizeThatFits always returns a width of 0 sizeThatFits.Width = (nfloat)Math.Max(sizeThatFits.Width, size.Width); return(sizeThatFits); }
public void FirstLocalVideoFrameWithSize(AgoraRtcEngineKit engine, CoreGraphics.CGSize size, nint elapsed) { var fixedSize = size.FixedSize(ContainerView.Bounds.Size); nfloat ratio; if (fixedSize.Width > 0 && fixedSize.Height > 0) { ratio = fixedSize.Width / fixedSize.Height; } else { ratio = ContainerView.Bounds.Width / ContainerView.Bounds.Height; } var viewWidth = NSLayoutConstraint.Create(LocalView, NSLayoutAttribute.Width, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Width, 0.249999f, 0f); var viewRatio = NSLayoutConstraint.Create(LocalView, NSLayoutAttribute.Width, NSLayoutRelation.Equal, LocalView, NSLayoutAttribute.Height, ratio, 0f); NSLayoutConstraint.DeactivateConstraints(new NSLayoutConstraint[] { LocalVideoWidth, LocalVideoHeight }); NSLayoutConstraint.ActivateConstraints(new NSLayoutConstraint[] { viewWidth, viewRatio }); }
public override void ResizeSubviewsWithOldSize(CoreGraphics.CGSize oldSize) { base.ResizeSubviewsWithOldSize(oldSize); var bounds = Bounds; var frame = bounds; frame.Height = trackHeight; frame.Width *= Value; progressBackground.Frame = frame; var x = frame.Right; frame.Height = thumbHeight; frame.Width = thumbWidth; frame.X = x - (thumbWidth / 2); thumb.Frame = frame; }
public override SizeF SizeThatFits(SizeF size) { IVisualElementRenderer renderer; if (!_rendererRef.TryGetTarget(out renderer)) { return(base.SizeThatFits(size)); } if (renderer.Element == null) { return(SizeF.Empty); } double width = size.Width; var height = size.Height > 0 ? size.Height : double.PositiveInfinity; var result = renderer.Element.Measure(width, height, MeasureFlags.IncludeMargins); return(new SizeF(result.Request.Width, result.Request.Height)); }
public override void ResizeSubviewsWithOldSize(CoreGraphics.CGSize oldSize) { base.ResizeSubviewsWithOldSize(oldSize); var bounds = Bounds; var frame = imageView.Frame; frame.Y = (bounds.Height - frame.Height) / 2; imageView.Frame = frame; var x = frame.Right + padding; frame = switchView.Frame; frame.Y = (bounds.Height - frame.Height) / 2; frame.X = bounds.Width - frame.Width - padding; switchView.Frame = frame; var right = frame.Left; textView.Frame = new CGRect(x, 0, right - padding - x, bounds.Height); }
public override void ResizeSubviewsWithOldSize(CoreGraphics.CGSize oldSize) { base.ResizeSubviewsWithOldSize(oldSize); var bounds = Bounds; TopLabel.SizeToFit(); BottomLabel.SizeToFit(); var topHeight = string.IsNullOrWhiteSpace(TopLabel.StringValue) ? 0 : TopLabel.Frame.Height; var bottomH = string.IsNullOrWhiteSpace(BottomLabel.StringValue) ? 0 : BottomLabel.Frame.Height; // if (tbHeights > 0 && bottomH > 0) // tbHeights += Pading; var tbHeights = topHeight + bottomH; var y = (bounds.Height - tbHeights) / 2; var frame = new CGRect(0, y, bounds.Width, topHeight); TopLabel.Frame = frame; y = frame.Bottom; frame = new CGRect(0, y, bounds.Width, bottomH); BottomLabel.Frame = frame; }
SizeF AddInsets(SizeF size) => new SizeF( width: size.Width + TextInsets.Left + TextInsets.Right, height: size.Height + TextInsets.Top + TextInsets.Bottom);
public override SizeF SizeThatFits(SizeF size) => AddInsets(base.SizeThatFits(size));
public override void Draw(CGRect rect) { base.Draw(rect); _previousSize = Bounds.Size; }
public override SizeF SizeThatFits(SizeF size) { var measured = base.SizeThatFits(size); return(_buttonLayoutManager?.SizeThatFits(size, measured) ?? measured); }
public override void ViewDidLoad() { base.ViewDidLoad(); // 1000= 1 second , the timer will run every second timer.Interval = 300000; timer.Enabled = true; timer.Elapsed += Timer_Elapsed; timer.Start(); var manager = new CLLocationManager(); manager.AuthorizationChanged += (sender, args) => { var popup_size = new CoreGraphics.CGSize(this.View.Frame.Width, this.View.Frame.Height + TabBarController.TabBar.Frame.Height + NavigationController.NavigationBar.Frame.Height); Console.WriteLine("Authorization changed to: {0}", args.Status); switch (args.Status) { case CLAuthorizationStatus.AuthorizedWhenInUse: LocationView.Close(); //getLocation(); break; case CLAuthorizationStatus.Denied: LocationView = new TurnOnLocalitationView(popup_size); LocationView.PopUp(true, delegate { Console.WriteLine("cpuv will close"); }); Console.WriteLine("No Access"); break; default: break; } }; if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { manager.RequestWhenInUseAuthorization(); } profile_view.Layer.BorderColor = UIColor.White.CGColor; profile_view.Layer.BorderWidth = 4f; var EyeTapped = new UITapGestureRecognizer(() => { ViewModel.ShowProfile(); }); eye_view.AddGestureRecognizer(EyeTapped); eye_view.UserInteractionEnabled = true; next_button.TouchUpInside += delegate { profile_view.Image = null; GetLocation(); ViewModel.GetProfilesDetails(); }; back_button.TouchUpInside += delegate { profile_view.Image = null; GetLocation(); ViewModel.GetProfilesDetails(); }; //all_points_image.SendSubviewToBack(this.View); //TabBarController.TabBar.RemoveFromSuperview(); }
public override CoreGraphics.CGSize SizeThatFits(CoreGraphics.CGSize size) { bottomBorder.Frame = new CGRect(0, 40 - 1, size.Width, 1); return(base.SizeThatFits(size)); }
public override void ViewDidLoad() { base.ViewDidLoad(); //getLocation(); home_page.TouchUpInside += delegate { ViewModel.ShowProfile(); }; var manager = new CLLocationManager(); manager.AuthorizationChanged += (sender, args) => { var popup_size = new CoreGraphics.CGSize(this.View.Frame.Width, this.View.Frame.Height); Console.WriteLine("Authorization changed to: {0}", args.Status); switch (args.Status) { case CLAuthorizationStatus.AuthorizedWhenInUse: LocationView.Close(); getLocation(); break; case CLAuthorizationStatus.Denied: LocationView = new TurnOnLocalitationView(popup_size); ViewModel.allprofiles.Clear(); LocationView.PopUp(true, delegate { Console.WriteLine("OPEN SETTINGS"); }); Console.WriteLine("No Access"); break; default: break; } }; if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { manager.RequestWhenInUseAuthorization(); } /*switch (CLLocationManager.Status) * { * case CLAuthorizationStatus.Authorized | CLAuthorizationStatus.AuthorizedAlways | CLAuthorizationStatus.AuthorizedWhenInUse: * Console.WriteLine("Access"); * break; * case CLAuthorizationStatus.Denied | CLAuthorizationStatus.NotDetermined | CLAuthorizationStatus.Restricted: * Console.WriteLine("No Access"); * break; * default: * Console.WriteLine("No Access"); * break; * }*/ var ShowProfile1 = new UITapGestureRecognizer(() => { try { if (!string.IsNullOrEmpty(ViewModel.AllProfiles[0].id)) { ViewModel.profile_image = ViewModel.AllProfiles[0].image_url; ViewModel.profile_id = ViewModel.AllProfiles[0].id; ViewModel.ShowProfile(); } } catch (Exception ex) { } }); var ShowProfile2 = new UITapGestureRecognizer(() => { try { if (!string.IsNullOrEmpty(ViewModel.AllProfiles[1].id)) { ViewModel.profile_image = ViewModel.AllProfiles[1].image_url; ViewModel.profile_id = ViewModel.AllProfiles[1].id; ViewModel.ShowProfile(); } } catch (Exception ex) { } }); var ShowProfile3 = new UITapGestureRecognizer(() => { try { if (!string.IsNullOrEmpty(ViewModel.AllProfiles[2].id)) { ViewModel.profile_image = ViewModel.AllProfiles[2].image_url; ViewModel.profile_id = ViewModel.AllProfiles[2].id; ViewModel.ShowProfile(); } } catch (Exception ex) { } }); var ShowProfile4 = new UITapGestureRecognizer(() => { try { if (!string.IsNullOrEmpty(ViewModel.AllProfiles[3].id)) { ViewModel.profile_image = ViewModel.AllProfiles[3].image_url; ViewModel.profile_id = ViewModel.AllProfiles[3].id; ViewModel.ShowProfile(); } } catch (Exception ex) { } }); var ShowProfile5 = new UITapGestureRecognizer(() => { try { if (!string.IsNullOrEmpty(ViewModel.AllProfiles[4].id)) { ViewModel.profile_image = ViewModel.AllProfiles[4].image_url; ViewModel.profile_id = ViewModel.AllProfiles[4].id; ViewModel.ShowProfile(); } }catch (Exception ex) { } }); var ShowProfile6 = new UITapGestureRecognizer(() => { try { if (!string.IsNullOrEmpty(ViewModel.AllProfiles[5].id)) { ViewModel.profile_image = ViewModel.AllProfiles[5].image_url; ViewModel.profile_id = ViewModel.AllProfiles[5].id; ViewModel.ShowProfile(); } } catch (Exception ex) { } }); var ShowProfile7 = new UITapGestureRecognizer(() => { try { if (!string.IsNullOrEmpty(ViewModel.AllProfiles[6].id)) { ViewModel.profile_image = ViewModel.AllProfiles[6].image_url; ViewModel.profile_id = ViewModel.AllProfiles[6].id; ViewModel.ShowProfile(); } } catch (Exception ex) { } }); var ShowProfile8 = new UITapGestureRecognizer(() => { try { if (!string.IsNullOrEmpty(ViewModel.AllProfiles[7].id)) { ViewModel.profile_image = ViewModel.AllProfiles[7].image_url; ViewModel.profile_id = ViewModel.AllProfiles[7].id; ViewModel.ShowProfile(); } } catch (Exception ex) { } }); var ShowProfile9 = new UITapGestureRecognizer(() => { try { if (!string.IsNullOrEmpty(ViewModel.AllProfiles[8].id)) { ViewModel.profile_image = ViewModel.AllProfiles[8].image_url; ViewModel.profile_id = ViewModel.AllProfiles[8].id; ViewModel.ShowProfile(); } } catch (Exception ex) { } }); //ViewModel.GetProfiles(); all_points_image.SendSubviewToBack(this.View); image_profile_1.AddGestureRecognizer(ShowProfile1); image_profile_2.AddGestureRecognizer(ShowProfile2); image_profile_3.AddGestureRecognizer(ShowProfile3); image_profile_4.AddGestureRecognizer(ShowProfile4); image_profile_5.AddGestureRecognizer(ShowProfile5); image_profile_6.AddGestureRecognizer(ShowProfile6); image_profile_7.AddGestureRecognizer(ShowProfile7); image_profile_8.AddGestureRecognizer(ShowProfile8); image_profile_9.AddGestureRecognizer(ShowProfile9); }