public LoadingOverlay(CGRect frame, string text) : base (frame) { BackgroundColor = UIColor.Black; Alpha = 0.75f; AutoresizingMask = UIViewAutoresizing.FlexibleDimensions; nfloat labelHeight = 22; nfloat labelWidth = Frame.Width - 20; nfloat centerX = Frame.Width / 2; nfloat centerY = Frame.Height / 2; activitySpinner = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge); activitySpinner.Frame = new CGRect ( centerX - (activitySpinner.Frame.Width / 2) , centerY - activitySpinner.Frame.Height - 20 , activitySpinner.Frame.Width , activitySpinner.Frame.Height); activitySpinner.AutoresizingMask = UIViewAutoresizing.FlexibleMargins; AddSubview (activitySpinner); activitySpinner.StartAnimating (); loadingLabel = new UILabel(new CGRect ( centerX - (labelWidth / 2), centerY + 20 , labelWidth , labelHeight )); loadingLabel.BackgroundColor = UIColor.Clear; loadingLabel.TextColor = UIColor.White; loadingLabel.Text = text; loadingLabel.TextAlignment = UITextAlignment.Center; loadingLabel.AutoresizingMask = UIViewAutoresizing.FlexibleMargins; AddSubview (loadingLabel); }
public RefreshTableHeaderView(CGRect rect) : base(rect) { this.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; BackgroundColor = new UIColor(0.88f, 0.9f, 0.92f, 1); CreateViews(); }
public override void Draw(CGRect rect) { using (var context = UIGraphics.GetCurrentContext()) { switch (_maskType) { case MaskType.Black: UIColor.FromWhiteAlpha(0f, 0.5f).SetColor(); context.FillRect(Bounds); break; case MaskType.Gradient: nfloat[] colors = new nfloat[] { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.75f }; nfloat[] locations = new nfloat[] { 0.0f, 1.0f }; using (var colorSpace = CGColorSpace.CreateDeviceRGB()) { using (var gradient = new CGGradient(colorSpace, colors, locations)) { var center = new CGPoint(Bounds.Size.Width / 2, Bounds.Size.Height / 2); float radius = Math.Min((float)Bounds.Size.Width, (float)Bounds.Size.Height); context.DrawRadialGradient(gradient, center, 0, center, radius, CGGradientDrawingOptions.DrawsAfterEndLocation); } } break; } } }
public override void LayoutSubviews() { base.LayoutSubviews(); userNameField.Frame = new CGRect(Bounds.X + 15, Bounds.Y + 60, Bounds.Width - 30, 32); userNameIconView.Frame = new CGRect(userNameField.Frame.Right - 28, userNameField.Frame.Y + 8, 16, 15); passwordField.Frame = new CGRect(Bounds.X + 15, Bounds.Y + 99, Bounds.Width - 30, 32); passwordIconView.Frame = new CGRect(passwordField.Frame.Right - 28, passwordField.Frame.Y + 8, 16, 15); loginButton.Frame = new CGRect(Bounds.X + 15, Bounds.Y + 146, Bounds.Width - 30, 30); forgotPasswordButton.Frame = new CGRect(Bounds.X + 15, Bounds.Y + 180, forgotPasswordButton.SizeThatFits(new CGSize(Bounds.Width - 30, 0)).Width, 33); arrowView.Frame = new CGRect(forgotPasswordButton.Frame.Right + 5, forgotPasswordButton.Frame.Top + 10, 8, 13); int orLabelYOffset = 230; if (!showForgotPassword) { orLabelYOffset -= 33; } orLabel.Bounds = new CGRect(0, 0, orLabel.SizeThatFits(new CGSize(Bounds.Width - 56, 0)).Width, 20); orLabel.Center = new CGPoint(Bounds.GetMidX(), Bounds.Y + orLabelYOffset); leftDividerView.Frame = CGRect.FromLTRB(Bounds.X + 15, orLabel.Center.Y + 1, orLabel.Frame.Left - 13, orLabel.Center.Y + 3); rightDividerView.Frame = CGRect.FromLTRB(orLabel.Frame.Right + 13, orLabel.Center.Y + 1, Bounds.Right - 15, orLabel.Center.Y + 3); registerSuggesionLabel.Frame = new CGRect(Bounds.X + 15, Bounds.Y + orLabelYOffset + 12, Bounds.Width - 30, 20); registerButton.Frame = new CGRect(Bounds.X + 15, Bounds.Y + orLabelYOffset + 42, Bounds.Width - 30, 30); //331 }
public override void ViewDidLoad() { base.ViewDidLoad(); View.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions; View.BackgroundColor = UIColor.White; var ratingConfig = new RatingConfig(emptyImage: UIImage.FromBundle(ratingStyle + "/empty"), filledImage: UIImage.FromBundle(ratingStyle + "/filled"), chosenImage: UIImage.FromBundle(ratingStyle + "/chosen")); // [Optional] Put a little space between the rating items. ratingConfig.ItemPadding = 5f; var ratingFrame = new CGRect(CGPoint.Empty, new CGSize(View.Bounds.Width, 125f));; ratingView = new PDRatingView(ratingFrame, ratingConfig); // [Optional] Set the current rating to display. decimal rating = 3.58m; //decimal halfRoundedRating = Math.Round(rating * 2m, MidpointRounding.AwayFromZero) / 2m; //decimal wholeRoundedRating = Math.Round(rating, MidpointRounding.AwayFromZero); ratingView.AverageRating = rating; // [Optional] Make it read-only to keep the user from setting a rating. //StarRating.UserInteractionEnabled = false; // [Optional] Attach to the rating event to do something with the chosen value. ratingView.RatingChosen += (sender, e) => { (new UIAlertView("Rated!", e.Rating.ToString() + " " + ratingStyle, null, "Ok")).Show(); }; View.Add(ratingView); }
CGSize getSizeFromScale(nfloat scale, CGRect rectangle) { nfloat width = rectangle.Width * scale; nfloat height = rectangle.Height * scale; return(new CGSize(width, height)); }
nfloat getScaleFromSize(CGSize size, CGRect rectangle) { nfloat scaleX = size.Width / rectangle.Width; nfloat scaleY = size.Height / rectangle.Height; return((nfloat)Math.Min(scaleX, scaleY)); }
public override void ViewDidLoad() { base.ViewDidLoad(); View.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions; View.BackgroundColor = UIColor.White; var ratingConfig = new RatingConfig(emptyImage: UIImage.FromBundle(ratingStyle + "/empty"), filledImage: UIImage.FromBundle(ratingStyle + "/filled"), chosenImage: UIImage.FromBundle(ratingStyle + "/chosen")); ratingConfig.ScaleSize = 10; // [Optional] Put a little space between the rating items. ratingConfig.ItemPadding = 5f; var ratingFrame = new CGRect(CGPoint.Empty, new CGSize(View.Bounds.Width, 125f));; ratingView = new PDRatingView(ratingFrame, ratingConfig); // [Optional] Set the current rating to display. decimal rating = 3.58m; //decimal halfRoundedRating = Math.Round(rating * 2m, MidpointRounding.AwayFromZero) / 2m; //decimal wholeRoundedRating = Math.Round(rating, MidpointRounding.AwayFromZero); ratingView.AverageRating = rating; // [Optional] Make it read-only to keep the user from setting a rating. //StarRating.UserInteractionEnabled = false; // [Optional] Attach to the rating event to do something with the chosen value. ratingView.RatingChosen += (sender, e) => { (new UIAlertView("Rated!", e.Rating.ToString() + " " + ratingStyle, null, "Ok")).Show(); }; View.Add(ratingView); }
public RefreshTableHeaderView (CGRect rect) : base (rect) { this.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; BackgroundColor = new UIColor (0.88f, 0.9f, 0.92f, 1); CreateViews (); }
public LoadingOverlay(CGRect frame, string text) : base(frame) { BackgroundColor = UIColor.Black; Alpha = 0.75f; AutoresizingMask = UIViewAutoresizing.FlexibleDimensions; nfloat labelHeight = 22; nfloat labelWidth = Frame.Width - 20; nfloat centerX = Frame.Width / 2; nfloat centerY = Frame.Height / 2; activitySpinner = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge); activitySpinner.Frame = new CGRect( centerX - (activitySpinner.Frame.Width / 2), centerY - activitySpinner.Frame.Height - 20, activitySpinner.Frame.Width, activitySpinner.Frame.Height); activitySpinner.AutoresizingMask = UIViewAutoresizing.FlexibleMargins; AddSubview(activitySpinner); activitySpinner.StartAnimating(); loadingLabel = new UILabel(new CGRect( centerX - (labelWidth / 2), centerY + 20, labelWidth, labelHeight )); loadingLabel.BackgroundColor = UIColor.Clear; loadingLabel.TextColor = UIColor.White; loadingLabel.Text = text; loadingLabel.TextAlignment = UITextAlignment.Center; loadingLabel.AutoresizingMask = UIViewAutoresizing.FlexibleMargins; AddSubview(loadingLabel); }
public ProfileCategoryDetailController (CGRect frame) { View.Frame = frame; InitSubviews(); ApplyStyles(); }
public static void FillRoundedRect(CGContext ctx, CGRect rect, nfloat radius) { var p = GraphicsUtil.MakeRoundedRectPath(rect, radius); ctx.AddPath(p); ctx.FillPath(); }
public static CGRect ApplyInsets(this CGRect rectangle, UIEdgeInsets insets) { return(CGRect.FromLTRB( rectangle.Left + insets.Left, rectangle.Top + insets.Top, rectangle.Right - insets.Right, rectangle.Bottom - insets.Bottom)); }
public ProgressHUD(CGRect frame) : base(frame) { UserInteractionEnabled = false; BackgroundColor = UIColor.Clear; Alpha = 0; AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; SetOSSpecificLookAndFeel(); }
public override void Draw(CGRect rect) { if (currentPath == null || currentPath.Empty) { return; } strokeColor.SetStroke(); currentPath.Stroke(); }
public ProgressHUD (CGRect frame) : base (frame) { UserInteractionEnabled = false; BackgroundColor = UIColor.Clear; Alpha = 0; AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; SetOSSpecificLookAndFeel (); }
public override void DrawPlaceholder(CGRect rect) { if (PlaceholderColor != null && PlaceholderFont != null && Placeholder != null) { PlaceholderColor.SetFill(); new NSString(Placeholder).DrawString(rect, PlaceholderFont, UILineBreakMode.TailTruncation); } }
public virtual void ViewFrameDidChange(global::System.Drawing.RectangleF newFrame) { if (IsDirectBinding) { MonoMac.ObjCRuntime.Messaging.void_objc_msgSend_RectangleF(this.Handle, selViewFrameDidChange_Handle, newFrame); } else { MonoMac.ObjCRuntime.Messaging.void_objc_msgSendSuper_RectangleF(this.SuperHandle, selViewFrameDidChange_Handle, newFrame); } }
UIButton GetButton(CGRect rect, UIImage backImage, string title) { var button = new UIButton(rect); button.SetBackgroundImage(backImage, UIControlState.Normal); button.SetTitle(title, UIControlState.Normal); button.SetTitleShadowColor(UIColor.DarkGray, UIControlState.Normal); button.TitleLabel.ShadowOffset = new CGSize(1, -1); button.TitleLabel.Font = FoodyTheme.SharedTheme.MainFont; return(button); }
public virtual void LayoutTabContentArea(global::System.Drawing.RectangleF frame) { if (IsDirectBinding) { MonoMac.ObjCRuntime.Messaging.void_objc_msgSend_RectangleF(this.Handle, selLayoutTabContentArea_Handle, frame); } else { MonoMac.ObjCRuntime.Messaging.void_objc_msgSendSuper_RectangleF(this.SuperHandle, selLayoutTabContentArea_Handle, frame); } }
public virtual void SetFrameOfSelectedTab(global::System.Drawing.RectangleF frame) { if (IsDirectBinding) { MonoMac.ObjCRuntime.Messaging.void_objc_msgSend_RectangleF(this.Handle, selSetFrameOfSelectedTab_Handle, frame); } else { MonoMac.ObjCRuntime.Messaging.void_objc_msgSendSuper_RectangleF(this.SuperHandle, selSetFrameOfSelectedTab_Handle, frame); } }
public override void Draw(CGRect rect) { var context = UIGraphics.GetCurrentContext(); context.DrawPath(CGPathDrawingMode.FillStroke); StatusLabel.TextColor.SetStroke(); context.BeginPath(); context.MoveTo(0, Bounds.Height - 1); context.AddLineToPoint(Bounds.Width, Bounds.Height - 1); context.StrokePath(); }
void Setup(CGRect frame) { var started = DateTime.UtcNow; if (overlayView != null) { overlayView.RemoveFromSuperview(); } if (UseCustomOverlayView) { overlayView = CustomOverlayView; } else { overlayView = new ZXingDefaultOverlayView(new CGRect(0, 0, this.Frame.Width, this.Frame.Height), TopText, BottomText, CancelButtonText, FlashButtonText, () => { var evt = OnCancelButtonPressed; if (evt != null) { evt(); } }, ToggleTorch); } if (overlayView != null) { /*UITapGestureRecognizer tapGestureRecognizer = new UITapGestureRecognizer (); * * tapGestureRecognizer.AddTarget (() => { * * var pt = tapGestureRecognizer.LocationInView(overlayView); * * Focus(pt); * * Console.WriteLine("OVERLAY TOUCH: " + pt.X + ", " + pt.Y); * * }); * tapGestureRecognizer.CancelsTouchesInView = false; * tapGestureRecognizer.NumberOfTapsRequired = 1; * tapGestureRecognizer.NumberOfTouchesRequired = 1; * * overlayView.AddGestureRecognizer (tapGestureRecognizer);*/ overlayView.Frame = new CGRect(0, 0, this.Frame.Width, this.Frame.Height); overlayView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; } var total = DateTime.UtcNow - started; Console.WriteLine("ZXingScannerView.Setup() took {0} ms.", total.TotalMilliseconds); }
public ZXingDefaultOverlayView(CGRect frame, string topText, string bottomText, string cancelText, string flashText, Action onCancel, Action onTorch) : base(frame) { this.cancelText = cancelText ?? "Cancel"; this.flashText = flashText ?? "Flash"; this.topText = topText ?? ""; this.bottomText = bottomText ?? ""; OnCancel = onCancel; OnTorch = onTorch; Initialize(); }
public ZXingDefaultOverlayView (CGRect frame, string topText, string bottomText, string cancelText, string flashText, Action onCancel, Action onTorch) : base(frame) { this.cancelText = cancelText ?? "Cancel"; this.flashText = flashText ?? "Flash"; this.topText = topText ?? ""; this.bottomText = bottomText ?? ""; OnCancel = onCancel; OnTorch = onTorch; Initialize(); }
public override void Draw(CGRect rect) { var context = UIGraphics.GetCurrentContext(); var bounds = Bounds; UIColor background = Enabled ? pressed ? HighlightedColor : NormalColor : DisabledColor; float alpha = 1; CGPath container; container = GraphicsUtil.MakeRoundedRectPath(bounds, 14); context.AddPath(container); context.Clip(); using (var cs = CGColorSpace.CreateDeviceRGB()){ var topCenter = new CGPoint(bounds.GetMidX(), 0); var midCenter = new CGPoint(bounds.GetMidX(), bounds.GetMidY()); var bottomCenter = new CGPoint(bounds.GetMidX(), bounds.GetMaxY()); using (var gradient = new CGGradient(cs, new nfloat [] { 0.23f, 0.23f, 0.23f, alpha, 0.47f, 0.47f, 0.47f, alpha }, new nfloat [] { 0, 1 })){ context.DrawLinearGradient(gradient, topCenter, bottomCenter, 0); } container = GraphicsUtil.MakeRoundedRectPath(bounds.Inset(1, 1), 13); context.AddPath(container); context.Clip(); using (var gradient = new CGGradient(cs, new nfloat [] { 0.05f, 0.05f, 0.05f, alpha, 0.15f, 0.15f, 0.15f, alpha }, new nfloat [] { 0, 1 })){ context.DrawLinearGradient(gradient, topCenter, bottomCenter, 0); } var nb = bounds.Inset(4, 4); container = GraphicsUtil.MakeRoundedRectPath(nb, 10); context.AddPath(container); context.Clip(); background.SetFill(); context.FillRect(nb); using (var gradient = new CGGradient(cs, new nfloat [] { 1, 1, 1, .35f, 1, 1, 1, 0.06f }, new nfloat [] { 0, 1 })){ context.DrawLinearGradient(gradient, topCenter, midCenter, 0); } context.SetLineWidth(2); context.AddPath(container); context.ReplacePathWithStrokedPath(); context.Clip(); using (var gradient = new CGGradient(cs, new nfloat [] { 1, 1, 1, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f }, new nfloat [] { 0, 1 })){ context.DrawLinearGradient(gradient, topCenter, bottomCenter, 0); } } }
public RadialProgressLayer(nfloat startRadius, nfloat endRadius, nfloat backgroundWidth, nfloat progressLayerWidth) : this() { this.startRadius = startRadius; this.endRadius = endRadius; this.backgroundWidth = backgroundWidth; this.progressLayerWidth = progressLayerWidth; Bounds = new CGRect(CGPoint.Empty, new CGSize(progressLayerWidth, progressLayerWidth)); BackBounds = new CGRect(CGPoint.Empty, new CGSize(backgroundWidth, backgroundWidth)); CenterPoint = new CGPoint(Bounds.GetMidX(), Bounds.GetMidY()); fullProgressImage = GenerateFullProgressImage(); }
public virtual void InsertPlaceholderForTab(CTTabView tab, global::System.Drawing.RectangleF frame, float yStretchiness) { if (tab == null) { throw new ArgumentNullException("tab"); } if (IsDirectBinding) { ChromiumTabsAPI.Messaging.void_objc_msgSend_IntPtr_RectangleF_float(this.Handle, selInsertPlaceholderForTabFrameYStretchiness_Handle, tab.Handle, frame, yStretchiness); } else { ChromiumTabsAPI.Messaging.void_objc_msgSendSuper_IntPtr_RectangleF_float(this.SuperHandle, selInsertPlaceholderForTabFrameYStretchiness_Handle, tab.Handle, frame, yStretchiness); } }
public virtual void DropTabContents(CTTabContents contents, global::System.Drawing.RectangleF frame, bool pinned) { if (contents == null) { throw new ArgumentNullException("contents"); } if (IsDirectBinding) { ChromiumTabsAPI.Messaging.void_objc_msgSend_IntPtr_RectangleF_bool(this.Handle, selDropTabContentsWithFrameAsPinnedTab_Handle, contents.Handle, frame, pinned); } else { ChromiumTabsAPI.Messaging.void_objc_msgSendSuper_IntPtr_RectangleF_bool(this.SuperHandle, selDropTabContentsWithFrameAsPinnedTab_Handle, contents.Handle, frame, pinned); } }
public void UpdateMonkey(CGRect bounds) { // Save location in top/left, not center, // in order to make it easier to draw the // monkeys on Android and other platforms. var widthOffset = Frame.Width * 0.5f; var heightOffset = Frame.Width * 0.5f; Monkey.X = (Center.X - widthOffset) / bounds.Width; Monkey.Y = (Center.Y - heightOffset) / bounds.Height; Monkey.Scale = Transform.GetScale (); Monkey.Rotation = Transform.GetRotation (); }
public void Update(Monkey monkey, CGRect bounds) { var transform = CGAffineTransform.MakeIdentity (); transform.Rotate (monkey.Rotation); transform.Scale (monkey.Scale, monkey.Scale); Transform = transform; // Convert location from top/left to center coords. var widthOffset = Frame.Width * 0.5f; var heightOffset = Frame.Width * 0.5f; var x = bounds.Width * monkey.X; var y = bounds.Height * monkey.Y; Center = new CGPoint (x + widthOffset, y + heightOffset); }
/// <summary> /// Creates a path for a rectangle with rounded corners /// </summary> /// <param name="rect"> /// The <see cref="RectangleF"/> rectangle bounds /// </param> /// <param name="radius"> /// The <see cref="System.Single"/> size of the rounded corners /// </param> /// <returns> /// A <see cref="CGPath"/> that can be used to stroke the rounded rectangle /// </returns> public static CGPath MakeRoundedRectPath (CGRect rect, nfloat radius) { nfloat minx = rect.Left; nfloat midx = rect.Left + (rect.Width)/2; nfloat maxx = rect.Right; nfloat miny = rect.Top; nfloat midy = rect.Y+rect.Size.Height/2; nfloat maxy = rect.Bottom; var path = new CGPath (); path.MoveToPoint (minx, midy); path.AddArcToPoint (minx, miny, midx, miny, radius); path.AddArcToPoint (maxx, miny, maxx, midy, radius); path.AddArcToPoint (maxx, maxy, midx, maxy, radius); path.AddArcToPoint (minx, maxy, minx, midy, radius); path.CloseSubpath (); return path; }
public override void LayoutSubviews() { if (new Version(Constants.Version) >= new Version(7, 0)) { var frame = Frame; var width = UIApplication.SharedApplication.StatusBarOrientation.HasFlag(UIDeviceOrientation.Portrait) ? frame.Size.Width : frame.Size.Width - UIApplication.SharedApplication.StatusBarFrame.Width; var height = UIApplication.SharedApplication.StatusBarOrientation.HasFlag(UIDeviceOrientation.Portrait) ? frame.Size.Height - UIApplication.SharedApplication.StatusBarFrame.Height : frame.Size.Height; var x = UIApplication.SharedApplication.StatusBarOrientation.HasFlag(UIDeviceOrientation.Portrait) ? 0 : frame.Location.X + UIApplication.SharedApplication.StatusBarFrame.Width; var y = UIApplication.SharedApplication.StatusBarOrientation.HasFlag(UIDeviceOrientation.Portrait) ? frame.Location.Y + UIApplication.SharedApplication.StatusBarFrame.Height : 0; Frame = new CGRect(x, y, width, height); } ///Using different layouts for the iPhone and iPad, so setup device specific requirements here. if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone) { Signature.Frame = new CGRect(10, 10, Bounds.Width - 20, Bounds.Height - 60); } else { Signature.Frame = new CGRect(84, 84, Bounds.Width - 168, Bounds.Width / 2); imageView.Frame = new CGRect(84, Signature.Frame.Height + 168, Frame.Width - 168, Frame.Width / 2); } //Button locations are based on the Frame, so must have their own frames set after the view's //Frame has been set. btnSave.Frame = new CGRect(10, Bounds.Height - 40, 120, 37); btnLoad.Frame = new CGRect(Bounds.Width - 130, Bounds.Height - 40, 120, 37); }
/// <summary> /// Creates a path for a rectangle with rounded corners /// </summary> /// <param name="rect"> /// The <see cref="RectangleF"/> rectangle bounds /// </param> /// <param name="radius"> /// The <see cref="System.Single"/> size of the rounded corners /// </param> /// <returns> /// A <see cref="CGPath"/> that can be used to stroke the rounded rectangle /// </returns> public static CGPath MakeRoundedRectPath(CGRect rect, nfloat radius) { nfloat minx = rect.Left; nfloat midx = rect.Left + (rect.Width) / 2; nfloat maxx = rect.Right; nfloat miny = rect.Top; nfloat midy = rect.Y + rect.Size.Height / 2; nfloat maxy = rect.Bottom; var path = new CGPath(); path.MoveToPoint(minx, midy); path.AddArcToPoint(minx, miny, midx, miny, radius); path.AddArcToPoint(maxx, miny, maxx, midy, radius); path.AddArcToPoint(maxx, maxy, midx, maxy, radius); path.AddArcToPoint(minx, maxy, minx, midy, radius); path.CloseSubpath(); return(path); }
private void Initialize () { Opaque = false; BackgroundColor = UIColor.Clear; //Add(_mainView); var picFrameWidth = Math.Round(Frame.Width * 0.90); //screenFrame.Width; var picFrameHeight = Math.Round(Frame.Height * 0.60); var picFrameX = (Frame.Width - picFrameWidth) / 2; var picFrameY = (Frame.Height - picFrameHeight) / 2; var picFrame = new CGRect((int)picFrameX, (int)picFrameY, (int)picFrameWidth, (int)picFrameHeight); //Setup Overlay var overlaySize = new CGSize (this.Frame.Width, this.Frame.Height - 44); topBg = new UIView (new CGRect (0, 0, overlaySize.Width, (overlaySize.Height - picFrame.Height) / 2)); topBg.Frame = new CGRect (0, 0, overlaySize.Width, overlaySize.Height * 0.30f); topBg.BackgroundColor = UIColor.Black; topBg.Alpha = 0.6f; topBg.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleBottomMargin; bottomBg = new UIView (new CGRect (0, topBg.Frame.Height + picFrame.Height, overlaySize.Width, topBg.Frame.Height)); bottomBg.Frame = new CGRect (0, overlaySize.Height * 0.70f, overlaySize.Width, overlaySize.Height * 0.30f); bottomBg.BackgroundColor = UIColor.Black; bottomBg.Alpha = 0.6f; bottomBg.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin; redLine = new UIView (new CGRect (0, overlaySize.Height * 0.5f - 2.0f, overlaySize.Width, 4.0f)); redLine.BackgroundColor = UIColor.Red; redLine.Alpha = 0.4f; redLine.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleTopMargin; this.AddSubview (redLine); this.AddSubview (topBg); this.AddSubview (bottomBg); var topTextLines = 1; if (!string.IsNullOrEmpty(topText)) topTextLines = topText.Split ('\n').Length; var botTextLines = 1; if (!string.IsNullOrEmpty(bottomText)) botTextLines = bottomText.Split ('\n').Length; textTop = new UILabel () { Frame = topBg.Frame, Text = topText, Font = UIFont.SystemFontOfSize(13), TextAlignment = UITextAlignment.Center, TextColor = UIColor.White, Lines = 0, BackgroundColor = UIColor.Clear }; textTop.SizeToFit (); this.AddSubview (textTop); textBottom = new UILabel () { Frame = bottomBg.Frame, Text = bottomText, Font = UIFont.SystemFontOfSize(13), TextAlignment = UITextAlignment.Center, TextColor = UIColor.White, Lines = 0, BackgroundColor = UIColor.Clear }; textBottom.SizeToFit (); this.AddSubview (textBottom); var captureDevice = AVCaptureDevice.DefaultDeviceWithMediaType(AVMediaType.Video); bool hasTorch = false; if (captureDevice != null) hasTorch = captureDevice.TorchAvailable; InvokeOnMainThread(delegate { // Setting tool bar var toolBar = new UIToolbar(new CGRect(0, Frame.Height - 44, Frame.Width, 44)); var buttons = new List<UIBarButtonItem>(); buttons.Add(new UIBarButtonItem(cancelText, UIBarButtonItemStyle.Done, delegate { OnCancel(); })); if (hasTorch) { buttons.Add(new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace)); buttons.Add(new UIBarButtonItem(flashText, UIBarButtonItemStyle.Done, delegate { OnTorch(); })); } toolBar.Items = buttons.ToArray(); toolBar.TintColor = UIColor.Black; toolBar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin; Add(toolBar); }); }
public ZXingScannerView(CGRect frame) : base(frame) { }
void PositionHUD(NSNotification notification) { nfloat keyboardHeight = 0; double animationDuration = 0; Frame = UIScreen.MainScreen.Bounds; UIInterfaceOrientation orientation = UIApplication.SharedApplication.StatusBarOrientation; bool ignoreOrientation = UIDevice.CurrentDevice.CheckSystemVersion(8, 0); if (notification != null) { var keyboardFrame = UIKeyboard.FrameEndFromNotification(notification); animationDuration = UIKeyboard.AnimationDurationFromNotification(notification); if (notification.Name == UIKeyboard.WillShowNotification || notification.Name == UIKeyboard.DidShowNotification) { if (ignoreOrientation || IsPortrait(orientation)) { keyboardHeight = keyboardFrame.Size.Height; } else { keyboardHeight = keyboardFrame.Size.Width; } } else { keyboardHeight = 0; } } else { keyboardHeight = VisibleKeyboardHeight; } CGRect orientationFrame = UIApplication.SharedApplication.GetKeyWindow().Bounds; CGRect statusBarFrame = UIApplication.SharedApplication.StatusBarFrame; if (!ignoreOrientation && IsLandscape(orientation)) { orientationFrame.Size = new CGSize(orientationFrame.Size.Height, orientationFrame.Size.Width); statusBarFrame.Size = new CGSize(statusBarFrame.Size.Height, statusBarFrame.Size.Width); } var activeHeight = orientationFrame.Size.Height; if (keyboardHeight > 0) { activeHeight += statusBarFrame.Size.Height; } activeHeight -= keyboardHeight; nfloat posY = (float)Math.Floor(activeHeight * 0.45); nfloat posX = orientationFrame.Size.Width / 2; nfloat textHeight = _stringLabel.Frame.Height / 2 + 40; switch (toastPosition) { case ToastPosition.Bottom: posY = activeHeight - textHeight; break; case ToastPosition.Center: // Already set above break; case ToastPosition.Top: posY = textHeight; break; default: break; } CGPoint newCenter; float rotateAngle; if (ignoreOrientation) { rotateAngle = 0.0f; newCenter = new CGPoint(posX, posY); } else { switch (orientation) { case UIInterfaceOrientation.PortraitUpsideDown: rotateAngle = (float)Math.PI; newCenter = new CGPoint(posX, orientationFrame.Size.Height - posY); break; case UIInterfaceOrientation.LandscapeLeft: rotateAngle = (float)(-Math.PI / 2.0f); newCenter = new CGPoint(posY, posX); break; case UIInterfaceOrientation.LandscapeRight: rotateAngle = (float)(Math.PI / 2.0f); newCenter = new CGPoint(orientationFrame.Size.Height - posY, posX); break; default: // as UIInterfaceOrientationPortrait rotateAngle = 0.0f; newCenter = new CGPoint(posX, posY); break; } } if (notification != null) { UIView.Animate(animationDuration, 0, UIViewAnimationOptions.AllowUserInteraction, delegate { MoveToPoint(newCenter, rotateAngle); }, null); } else { MoveToPoint(newCenter, rotateAngle); } }
public virtual RefreshTableHeaderView MakeRefreshTableHeaderView(CGRect rect) { return(new RefreshTableHeaderView(rect)); }
/// <summary> /// Draws the view within the specified rectangle. /// </summary> /// <param name="rect">Rect.</param> public override void Draw(CGRect rect) { _rect = rect; base.Draw(rect); lock (_bufferSynchronisation) { // recreate the view. View2D view = this.CreateView(this.Frame); float zoomFactor = (float)this.Map.Projection.ToZoomFactor(this.MapZoom); // call the canvas renderer. CGContext context = UIGraphics.GetCurrentContext(); if (context != null) { context.InterpolationQuality = CGInterpolationQuality.None; context.SetShouldAntialias(false); context.SetBlendMode(CGBlendMode.Copy); context.SetAlpha(1); long afterViewChanged = DateTime.Now.Ticks; CGContextRenderer renderer = new CGContextRenderer(1); renderer.Render( new CGContextWrapper(context, this.Frame), view, zoomFactor, new Primitive2D[] { _onScreenBuffer }); long afterRendering = DateTime.Now.Ticks; } } }
/// <summary> /// Initializes a new instance of the <see cref="OsmSharp.iOS.UI.MapView"/> class. /// </summary> /// <param name="frame">Frame.</param> public MapView(CGRect frame) : base(frame) { this.Initialize(new GeoCoordinate(0, 0), new Map(), 0, 16); }
public override void Draw (CGRect rect) { CGContext context = UIGraphics.GetCurrentContext(); element.Draw(rect, context, this); }
public override void Draw(CGRect rect) { if (currentPath == null || currentPath.Empty) return; strokeColor.SetStroke (); currentPath.Stroke (); }
UIImage GetImage(UIColor strokeColor, UIColor fillColor, CGSize size, nfloat scale, bool shouldCrop = true, bool keepAspectRatio = true) { if (size.Width == 0 || size.Height == 0 || scale <= 0 || strokeColor == null || fillColor == null) return null; nfloat uncroppedScale; CGRect croppedRectangle = new CGRect (); CGPoint [] cachedPoints; if (shouldCrop && (cachedPoints = Points).Any ()) { croppedRectangle = getCroppedRectangle (cachedPoints); croppedRectangle.Width /= scale; croppedRectangle.Height /= scale; if (croppedRectangle.X >= 5) { croppedRectangle.X -= 5; croppedRectangle.Width += 5; } if (croppedRectangle.Y >= 5) { croppedRectangle.Y -= 5; croppedRectangle.Height += 5; } if (croppedRectangle.X + croppedRectangle.Width <= size.Width - 5) croppedRectangle.Width += 5; if (croppedRectangle.Y + croppedRectangle.Height <= size.Height - 5) croppedRectangle.Height += 5; nfloat scaleX = croppedRectangle.Width / Bounds.Width; nfloat scaleY = croppedRectangle.Height / Bounds.Height; uncroppedScale = 1 / (nfloat)Math.Max (scaleX, scaleY); } else { uncroppedScale = scale; } //Make sure the image is scaled to the screen resolution in case of Retina display. if (keepAspectRatio) UIGraphics.BeginImageContext (size); else UIGraphics.BeginImageContext (new CGSize (croppedRectangle.Width * uncroppedScale, croppedRectangle.Height * uncroppedScale)); //Create context and set the desired options CGContext context = UIGraphics.GetCurrentContext (); context.SetFillColor (fillColor.CGColor); context.FillRect (new CGRect (0, 0, size.Width, size.Height)); context.SetStrokeColor (strokeColor.CGColor); context.SetLineWidth (StrokeWidth); context.SetLineCap (CGLineCap.Round); context.SetLineJoin (CGLineJoin.Round); context.ScaleCTM (uncroppedScale, uncroppedScale); //Obtain all drawn paths from the array foreach (var bezierPath in paths) { var tempPath = (UIBezierPath)bezierPath.Copy (); if (shouldCrop) tempPath.ApplyTransform (CGAffineTransform.MakeTranslation (-croppedRectangle.X, -croppedRectangle.Y)); CGPath path = tempPath.CGPath; context.AddPath (path); tempPath = null; } context.StrokePath (); UIImage image = UIGraphics.GetImageFromCurrentImageContext (); UIGraphics.EndImageContext (); return image; }
nfloat getScaleFromSize(CGSize size, CGRect rectangle) { nfloat scaleX = size.Width / rectangle.Width; nfloat scaleY = size.Height / rectangle.Height; return (nfloat)Math.Min (scaleX, scaleY); }
CGSize getSizeFromScale(nfloat scale, CGRect rectangle) { nfloat width = rectangle.Width * scale; nfloat height = rectangle.Height * scale; return new CGSize (width, height); }
UIButton GetButton(CGRect rect, UIImage backImage, string title) { var button = new UIButton (rect); button.SetBackgroundImage (backImage, UIControlState.Normal); button.SetTitle (title, UIControlState.Normal); button.SetTitleShadowColor (UIColor.DarkGray, UIControlState.Normal); button.TitleLabel.ShadowOffset = new CGSize (1, -1); button.TitleLabel.Font = FoodyTheme.SharedTheme.MainFont; return button; }
public override void LayoutSubviews() { if (new Version(Constants.Version) >= new Version (7, 0)) { var frame = Frame; var width = UIApplication.SharedApplication.StatusBarOrientation.HasFlag(UIInterfaceOrientation.Portrait) ? frame.Size.Width : frame.Size.Width - UIApplication.SharedApplication.StatusBarFrame.Width ; var height = UIApplication.SharedApplication.StatusBarOrientation.HasFlag (UIInterfaceOrientation.Portrait) ? frame.Size.Height - UIApplication.SharedApplication.StatusBarFrame.Height : frame.Size.Height; var x = UIApplication.SharedApplication.StatusBarOrientation.HasFlag (UIInterfaceOrientation.Portrait) ? 0 : frame.Location.X + UIApplication.SharedApplication.StatusBarFrame.Width; var y = UIApplication.SharedApplication.StatusBarOrientation.HasFlag (UIInterfaceOrientation.Portrait) ? frame.Location.Y + UIApplication.SharedApplication.StatusBarFrame.Height : 0; Frame = new CGRect (x, y, width, height); } ///Using different layouts for the iPhone and iPad, so setup device specific requirements here. if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone) Signature.Frame = new CGRect (10, 10, Bounds.Width - 20, Bounds.Height - 60); else { Signature.Frame = new CGRect (84, 84, Bounds.Width - 168, Bounds.Width / 2); imageView.Frame = new CGRect (84, Signature.Frame.Height + 168, Frame.Width - 168, Frame.Width / 2); } //Button locations are based on the Frame, so must have their own frames set after the view's //Frame has been set. btnSave.Frame = new CGRect (10, Bounds.Height - 40, 120, 37); btnLoad.Frame = new CGRect (Bounds.Width - 130, Bounds.Height - 40, 120, 37); }
public abstract void Draw(CGRect bounds, CGContext context, UIView view);
/// <summary> /// Holds the drawing rectangle. /// </summary> //private System.Drawing.RectangleF _rect; /// <summary> /// Creates the view. /// </summary> /// <returns>The view.</returns> public View2D CreateView(CGRect rect) { if (this.Map != null) { double[] sceneCenter = this.Map.Projection.ToPixel(this.MapCenter.Latitude, this.MapCenter.Longitude); float sceneZoomFactor = (float)this.Map.Projection.ToZoomFactor(this.MapZoom); return View2D.CreateFrom(sceneCenter[0], sceneCenter[1], rect.Width, rect.Height, sceneZoomFactor, _invertX, _invertY, this.MapTilt); } return null; }
public abstract nfloat Height(CGRect bounds);
public PDRatingView(CGRect frame, RatingConfig config) : this(frame, config, 0m) { }
public PDRatingView(CGRect frame, RatingConfig config, decimal averageRating) : this(config, averageRating) { Frame = frame; }
void UpdatePosition(bool textOnly = false) { nfloat hudWidth = 100f; nfloat hudHeight = 100f; nfloat stringWidth = 0f; nfloat stringHeight = 0f; nfloat stringHeightBuffer = 20f; nfloat stringAndImageHeightBuffer = 80f; CGRect labelRect = new CGRect(); string @string = StringLabel.Text; // False if it's text-only bool imageUsed = (ImageView.Image != null) || (ImageView.Hidden); if (textOnly) { imageUsed = false; } if (imageUsed) { hudHeight = stringAndImageHeightBuffer + stringHeight; } else { hudHeight = (textOnly ? stringHeightBuffer : stringHeightBuffer + 40); } if (!string.IsNullOrEmpty(@string)) { int lineCount = Math.Min(10, @string.Split('\n').Length + 1); if (IsIOS7OrNewer) { var stringSize = new NSString(@string).GetBoundingRect(new CGSize(200, 30 * lineCount), NSStringDrawingOptions.UsesLineFragmentOrigin, new UIStringAttributes { Font = StringLabel.Font }, null); stringWidth = stringSize.Width; stringHeight = stringSize.Height; } else { var stringSize = new NSString(@string).StringSize(StringLabel.Font, new CGSize(200, 30 * lineCount)); stringWidth = stringSize.Width; stringHeight = stringSize.Height; } hudHeight += stringHeight; if (stringWidth > hudWidth) { hudWidth = (float)Math.Ceiling(stringWidth / 2) * 2; } float labelRectY = imageUsed ? 66 : 9; if (hudHeight > 100) { labelRect = new CGRect(12, labelRectY, hudWidth, stringHeight); hudWidth += 24; } else { hudWidth += 24; labelRect = new CGRect(0, labelRectY, hudWidth, stringHeight); } } // Adjust for Cancel Button var cancelRect = new CGRect(); string @cancelCaption = _cancelHud == null ? null : CancelHudButton.Title(UIControlState.Normal); if (!string.IsNullOrEmpty(@cancelCaption)) { const int gap = 20; if (IsIOS7OrNewer) { var stringSize = new NSString(@cancelCaption).GetBoundingRect(new CGSize(200, 300), NSStringDrawingOptions.UsesLineFragmentOrigin, new UIStringAttributes { Font = StringLabel.Font }, null); stringWidth = stringSize.Width; stringHeight = stringSize.Height; } else { var stringSize = new NSString(@cancelCaption).StringSize(StringLabel.Font, new CGSize(200, 300)); stringWidth = stringSize.Width; stringHeight = stringSize.Height; } if (stringWidth > hudWidth) { hudWidth = (float)Math.Ceiling(stringWidth / 2) * 2; } // Adjust for label nfloat cancelRectY = 0f; if (labelRect.Height > 0) { cancelRectY = labelRect.Y + labelRect.Height + (nfloat)gap; } else { if (string.IsNullOrEmpty(@string)) { cancelRectY = 76; } else { cancelRectY = (imageUsed ? 66 : 9); } } if (hudHeight > 100) { cancelRect = new CGRect(12, cancelRectY, hudWidth, stringHeight); labelRect = new CGRect(12, labelRect.Y, hudWidth, labelRect.Height); hudWidth += 24; } else { hudWidth += 24; cancelRect = new CGRect(0, cancelRectY, hudWidth, stringHeight); labelRect = new CGRect(0, labelRect.Y, hudWidth, labelRect.Height); } CancelHudButton.Frame = cancelRect; hudHeight += (cancelRect.Height + (string.IsNullOrEmpty(@string) ? 10 : gap)); } HudView.Bounds = new CGRect(0, 0, hudWidth, hudHeight); if (!string.IsNullOrEmpty(@string)) { ImageView.Center = new CGPoint(HudView.Bounds.Width / 2, 36); } else { ImageView.Center = new CGPoint(HudView.Bounds.Width / 2, HudView.Bounds.Height / 2); } StringLabel.Hidden = false; StringLabel.Frame = labelRect; if (!textOnly) { if (!string.IsNullOrEmpty(@string) || !string.IsNullOrEmpty(@cancelCaption)) { SpinnerView.Center = new CGPoint((float)Math.Ceiling(HudView.Bounds.Width / 2.0f) + 0.5f, 40.5f); if (_progress != -1) { BackgroundRingLayer.Position = RingLayer.Position = new CGPoint(HudView.Bounds.Width / 2, 36f); } } else { SpinnerView.Center = new CGPoint((float)Math.Ceiling(HudView.Bounds.Width / 2.0f) + 0.5f, (float)Math.Ceiling(HudView.Bounds.Height / 2.0f) + 0.5f); if (_progress != -1) { BackgroundRingLayer.Position = RingLayer.Position = new CGPoint(HudView.Bounds.Width / 2, HudView.Bounds.Height / 2.0f + 0.5f); } } } }
public override void Draw(CGRect rect) { using (var context = UIGraphics.GetCurrentContext ()) { switch (_maskType) { case MaskType.Black: UIColor.FromWhiteAlpha (0f, 0.5f).SetColor (); context.FillRect (Bounds); break; case MaskType.Gradient: nfloat[] colors = new nfloat[] { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.75f }; nfloat[] locations = new nfloat[] { 0.0f, 1.0f }; using (var colorSpace = CGColorSpace.CreateDeviceRGB ()) { using (var gradient = new CGGradient (colorSpace, colors, locations)) { var center = new CGPoint (Bounds.Size.Width / 2, Bounds.Size.Height / 2); float radius = Math.Min ((float)Bounds.Size.Width, (float)Bounds.Size.Height); context.DrawRadialGradient (gradient, center, 0, center, radius, CGGradientDrawingOptions.DrawsAfterEndLocation); } } break; } } }
void UpdatePosition(bool textOnly = false) { nfloat hudWidth = 100f; nfloat hudHeight = 100f; nfloat stringWidth = 0f; nfloat stringHeight = 0f; nfloat stringHeightBuffer = 20f; nfloat stringAndImageHeightBuffer = 80f; CGRect labelRect = new CGRect (); string @string = StringLabel.Text; // False if it's text-only bool imageUsed = (ImageView.Image != null) || (ImageView.Hidden); if (textOnly) { imageUsed = false; } if (imageUsed) { hudHeight = stringAndImageHeightBuffer + stringHeight; } else { hudHeight = (textOnly ? stringHeightBuffer : stringHeightBuffer + 40); } if (!string.IsNullOrEmpty (@string)) { int lineCount = Math.Min (10, @string.Split ('\n').Length + 1); if (IsIOS7OrNewer) { var stringSize = new NSString (@string).GetBoundingRect (new CGSize (200, 30 * lineCount), NSStringDrawingOptions.UsesLineFragmentOrigin, new UIStringAttributes{ Font = StringLabel.Font }, null); stringWidth = stringSize.Width; stringHeight = stringSize.Height; } else { var stringSize = new NSString (@string).StringSize (StringLabel.Font, new CGSize (200, 30 * lineCount)); stringWidth = stringSize.Width; stringHeight = stringSize.Height; } hudHeight += stringHeight; if (stringWidth > hudWidth) hudWidth = (float)Math.Ceiling (stringWidth / 2) * 2; float labelRectY = imageUsed ? 66 : 9; if (hudHeight > 100) { labelRect = new CGRect (12, labelRectY, hudWidth, stringHeight); hudWidth += 24; } else { hudWidth += 24; labelRect = new CGRect (0, labelRectY, hudWidth, stringHeight); } } // Adjust for Cancel Button var cancelRect = new CGRect (); string @cancelCaption = _cancelHud == null ? null : CancelHudButton.Title (UIControlState.Normal); if (!string.IsNullOrEmpty (@cancelCaption)) { const int gap = 20; if (IsIOS7OrNewer) { var stringSize = new NSString (@cancelCaption).GetBoundingRect (new CGSize (200, 300), NSStringDrawingOptions.UsesLineFragmentOrigin, new UIStringAttributes{ Font = StringLabel.Font }, null); stringWidth = stringSize.Width; stringHeight = stringSize.Height; } else { var stringSize = new NSString (@cancelCaption).StringSize (StringLabel.Font, new CGSize (200, 300)); stringWidth = stringSize.Width; stringHeight = stringSize.Height; } if (stringWidth > hudWidth) hudWidth = (float)Math.Ceiling (stringWidth / 2) * 2; // Adjust for label nfloat cancelRectY = 0f; if (labelRect.Height > 0) { cancelRectY = labelRect.Y + labelRect.Height + (nfloat)gap; } else { if (string.IsNullOrEmpty (@string)) { cancelRectY = 76; } else { cancelRectY = (imageUsed ? 66 : 9); } } if (hudHeight > 100) { cancelRect = new CGRect (12, cancelRectY, hudWidth, stringHeight); labelRect = new CGRect (12, labelRect.Y, hudWidth, labelRect.Height); hudWidth += 24; } else { hudWidth += 24; cancelRect = new CGRect (0, cancelRectY, hudWidth, stringHeight); labelRect = new CGRect (0, labelRect.Y, hudWidth, labelRect.Height); } CancelHudButton.Frame = cancelRect; hudHeight += (cancelRect.Height + (string.IsNullOrEmpty (@string) ? 10 : gap)); } HudView.Bounds = new CGRect (0, 0, hudWidth, hudHeight); if (!string.IsNullOrEmpty (@string)) ImageView.Center = new CGPoint (HudView.Bounds.Width / 2, 36); else ImageView.Center = new CGPoint (HudView.Bounds.Width / 2, HudView.Bounds.Height / 2); StringLabel.Hidden = false; StringLabel.Frame = labelRect; if (!textOnly) { if (!string.IsNullOrEmpty (@string) || !string.IsNullOrEmpty(@cancelCaption)) { SpinnerView.Center = new CGPoint ((float)Math.Ceiling (HudView.Bounds.Width / 2.0f) + 0.5f, 40.5f); if (_progress != -1) { BackgroundRingLayer.Position = RingLayer.Position = new CGPoint (HudView.Bounds.Width / 2, 36f); } } else { SpinnerView.Center = new CGPoint ((float)Math.Ceiling (HudView.Bounds.Width / 2.0f) + 0.5f, (float)Math.Ceiling (HudView.Bounds.Height / 2.0f) + 0.5f); if (_progress != -1) { BackgroundRingLayer.Position = RingLayer.Position = new CGPoint (HudView.Bounds.Width / 2, HudView.Bounds.Height / 2.0f + 0.5f); } } } }
/// <summary> /// Creates a new instance of the GlassButton using the specified dimensions /// </summary> public GlassButton (CGRect frame) : base (frame) { NormalColor = new UIColor (0.55f, 0.04f, 0.02f, 1); HighlightedColor = UIColor.Black; DisabledColor = UIColor.Gray; }
public AVCaptureScannerView(CGRect frame) : base(frame) { }
public override void Draw (CGRect rect) { var context = UIGraphics.GetCurrentContext (); var bounds = Bounds; UIColor background = Enabled ? pressed ? HighlightedColor : NormalColor : DisabledColor; float alpha = 1; CGPath container; container = GraphicsUtil.MakeRoundedRectPath (bounds, 14); context.AddPath (container); context.Clip (); using (var cs = CGColorSpace.CreateDeviceRGB ()){ var topCenter = new CGPoint (bounds.GetMidX (), 0); var midCenter = new CGPoint (bounds.GetMidX (), bounds.GetMidY ()); var bottomCenter = new CGPoint (bounds.GetMidX (), bounds.GetMaxY ()); using (var gradient = new CGGradient (cs, new nfloat [] { 0.23f, 0.23f, 0.23f, alpha, 0.47f, 0.47f, 0.47f, alpha }, new nfloat [] {0, 1})){ context.DrawLinearGradient (gradient, topCenter, bottomCenter, 0); } container = GraphicsUtil.MakeRoundedRectPath (bounds.Inset (1, 1), 13); context.AddPath (container); context.Clip (); using (var gradient = new CGGradient (cs, new nfloat [] { 0.05f, 0.05f, 0.05f, alpha, 0.15f, 0.15f, 0.15f, alpha}, new nfloat [] {0, 1})){ context.DrawLinearGradient (gradient, topCenter, bottomCenter, 0); } var nb = bounds.Inset (4, 4); container = GraphicsUtil.MakeRoundedRectPath (nb, 10); context.AddPath (container); context.Clip (); background.SetFill (); context.FillRect (nb); using (var gradient = new CGGradient (cs, new nfloat [] { 1, 1, 1, .35f, 1, 1, 1, 0.06f }, new nfloat [] { 0, 1 })){ context.DrawLinearGradient (gradient, topCenter, midCenter, 0); } context.SetLineWidth (2); context.AddPath (container); context.ReplacePathWithStrokedPath (); context.Clip (); using (var gradient = new CGGradient (cs, new nfloat [] { 1, 1, 1, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f }, new nfloat [] { 0, 1 })){ context.DrawLinearGradient (gradient, topCenter, bottomCenter, 0); } } }
public override void LayoutSubviews () { Frame = new CGRect (0, 0, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Height); profileDetailsView.Frame = new CGRect (0, 0, UIScreen.MainScreen.Bounds.Width, 158); ProfileTableViewController.View.Frame = new CGRect (0, profileDetailsView.Frame.Bottom - 6, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Height - profileDetailsView.Bounds.Height); workoutButton.Frame = new CGRect (0, profileDetailsView.Frame.Bottom - 46, 111, 44); cardioButton.Frame = new CGRect (111, profileDetailsView.Frame.Bottom - 46, 111, 44); journalButton.Frame = new CGRect (222, profileDetailsView.Frame.Bottom - 46, 111, 44); base.LayoutSubviews (); }
public SignaturePadView(CGRect frame) { Frame = frame; Initialize (); }