UIVisualEffectView ConfigureVibrancyView(UIBlurEffect blurEffect)
        {
            var vibrancyEffect = UIVibrancyEffect.FromBlurEffect(blurEffect);

            vibrancyView.Effect = vibrancyEffect;
            vibrancyView.TranslatesAutoresizingMaskIntoConstraints = false;
            return(vibrancyView);
        }
 public void ApplyTheme(Theme theme)
 {
     if (useBlur && IsViewLoaded)
     {
         blurEffect = UIBlurEffect.FromStyle(theme.IsDark ? UIBlurEffectStyle.Dark : UIBlurEffectStyle.Light);
         TableView.BackgroundView  = new UIVisualEffectView(effect: blurEffect);
         TableView.SeparatorEffect = UIVibrancyEffect.FromBlurEffect(blurEffect);
     }
 }
Beispiel #3
0
        UIVisualEffectView ConfigureVibrancyView(UIBlurEffect blurEffect)
        {
            // DARK MODE ADOPTION: Changed to use a specific iOS 13 vibrancy style:
            var vibrancyEffect = UIVibrancyEffect.FromBlurEffect(blurEffect, UIVibrancyEffectStyle.SecondaryLabel);

            vibrancyView.Effect = vibrancyEffect;
            vibrancyView.TranslatesAutoresizingMaskIntoConstraints = false;
            return(vibrancyView);
        }
Beispiel #4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            foregroundContentView       = new UIVisualEffectView(UIVibrancyEffect.FromBlurEffect(blurEffect));
            backgroundView              = new UIVisualEffectView(blurEffect);
            foregroundContentScrollView = new UIScrollView();

            ConfigureViews();
        }
        public static UIVisualEffectView Vibrant(CGRect frame, UIBlurEffectStyle style)
        {
            var blurEffect     = UIBlurEffect.FromStyle(style);
            var vibrancyEffect = UIVibrancyEffect.FromBlurEffect(blurEffect);
            var vibrancyView   = new UIVisualEffectView(vibrancyEffect)
            {
                Frame = frame
            };

            return(vibrancyView);
        }
Beispiel #6
0
        protected override void InitializeView()
        {
            base.InitializeView();

            // set TableCell appearance
            this.Appearance.BackgroundImage             = "bg.png";
            this.Appearance.BackgroundBlurEnabled       = true;
            this.Appearance.CellBackgroundColor         = UIColor.Clear;
            this.Appearance.CellSelectedBackgroundColor = UIColor.White.ColorWithAlpha(0.5f);
            this.Appearance.HeaderTextColor             = UIColor.Gray.ColorWithAlpha(0.5f);
            this.Appearance.SeparatorEffect             = UIVibrancyEffect.FromBlurEffect(UIBlurEffect.FromStyle(UIBlurEffectStyle.ExtraLight));
            this.Appearance.TitleTextAttributes         = new UITextAttributes()
            {
                Font = UIFont.FromName(".HelveticaNeueInterface-Light", 15f)
            };
            this.Appearance.ShowSeparator = true;
        }
Beispiel #7
0
        void SetupMenuBlurForMenu(UISideMenuNavigationController forMenu)
        {
            RemoveMenuBlurForMenu(forMenu);

            var view = forMenu.VisibleViewController?.View;

            if (forMenu == null ||
                view == null ||
                UIKit.UIAccessibility.IsReduceTransparencyEnabled)
            {
                return;
            }

            if (forMenu.OriginalMenuBackgroundColor == null)
            {
                forMenu.OriginalMenuBackgroundColor = view.BackgroundColor;
            }

            if (!BlurEffectStyle.HasValue)
            {
                return;
            }

            var blurEffect = UIBlurEffect.FromStyle(BlurEffectStyle.Value);
            var blurView   = new UIVisualEffectView(blurEffect);

            view.BackgroundColor = UIColor.Clear;
            var tableViewController = forMenu.VisibleViewController as UITableViewController;

            if (tableViewController != null)
            {
                tableViewController.TableView.BackgroundView  = blurView;
                tableViewController.TableView.SeparatorEffect = UIVibrancyEffect.FromBlurEffect(blurEffect);
                tableViewController.TableView.ReloadData();
            }
            else
            {
                blurView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
                blurView.Frame            = view.Bounds;
                view.InsertSubview(blurView, atIndex: 0);
            }
        }
        private void InitializeFakeNavBar()
        {
            var blurEffect = UIBlurEffect.FromStyle(UIBlurEffectStyle.Regular);

            _blurView02 = new UIVisualEffectView(blurEffect)
            {
                ////BackgroundColor = seaShellColor.ColorWithAlpha(0.9f),
            };

            var vibrancyEffect     = UIVibrancyEffect.FromBlurEffect(blurEffect);
            var vibrancyEffectView = new UIVisualEffectView(vibrancyEffect);

            _plainView02 = new UIView()
            {
                BackgroundColor = ViewBackgroundColor,
            };

            View.AddSubview(_blurView02);
            _blurView02.ContentView.Add(vibrancyEffectView);
            vibrancyEffectView.ContentView.Add(_plainView02);

            _blurView02.TranslatesAutoresizingMaskIntoConstraints = false;
            var index     = 1;
            var topOffset = (HeightOfNavBars * index) + (SpacingBetweenNavBars * (index + 1));
            ////_blurView02.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor, topOffset).Active = true;
            ////_blurView02.LeftAnchor.ConstraintEqualTo(View.LeftAnchor).Active = true;
            ////_blurView02.RightAnchor.ConstraintEqualTo(View.RightAnchor).Active = true;
            ////_blurView02.HeightAnchor.ConstraintEqualTo(HeightOfNavBars).Active = true;

            ////vibrancyEffectView.TranslatesAutoresizingMaskIntoConstraints = false;
            ////vibrancyEffectView.TopAnchor.ConstraintEqualTo(_blurView02.ContentView.TopAnchor).Active = true;
            ////vibrancyEffectView.LeftAnchor.ConstraintEqualTo(_blurView02.ContentView.LeftAnchor).Active = true;
            ////vibrancyEffectView.RightAnchor.ConstraintEqualTo(_blurView02.ContentView.RightAnchor).Active = true;
            ////vibrancyEffectView.BottomAnchor.ConstraintEqualTo(_blurView02.ContentView.BottomAnchor).Active = true;

            ////_plainView02.TranslatesAutoresizingMaskIntoConstraints = false;
            ////_plainView02.TopAnchor.ConstraintEqualTo(vibrancyEffectView.ContentView.TopAnchor).Active = true;
            ////_plainView02.LeftAnchor.ConstraintEqualTo(vibrancyEffectView.ContentView.LeftAnchor).Active = true;
            ////_plainView02.RightAnchor.ConstraintEqualTo(vibrancyEffectView.ContentView.RightAnchor).Active = true;
            ////_plainView02.BottomAnchor.ConstraintEqualTo(vibrancyEffectView.ContentView.BottomAnchor).Active = true;
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            try {
                TableView.Source = new FormSource(this);

                if (AutoCancelButton && (NavigationController == null || NavigationController.ViewControllers.Length == 1))
                {
                    NavigationItem.LeftBarButtonItem = new UIBarButtonItem(
                        UIBarButtonSystemItem.Cancel,
                        HandleCancel);
                }

                if (AutoDoneButton && (NavigationController == null || NavigationController.ViewControllers.Length == 1))
                {
                    NavigationItem.RightBarButtonItem = new UIBarButtonItem(
                        UIBarButtonSystemItem.Done,
                        HandleDone);
                }

                if (useBlur)
                {
                    TableView.BackgroundColor = UIColor.Clear;
                    TableView.BackgroundView  = new UIVisualEffectView(effect: blurEffect);
                    TableView.SeparatorEffect = UIVibrancyEffect.FromBlurEffect(blurEffect);
                }
                else
                {
                    Theme.Current.Apply(this.TableView);
                }
            }
            catch (Exception ex) {
                Log.Error(ex);
            }
        }
Beispiel #10
0
        public FancyiOSCell(NSString cellId) : base(UITableViewCellStyle.Default, cellId)
        {
            SelectionStyle = UITableViewCellSelectionStyle.Gray;

            imageView = new UIImageView()
            {
                Bounds = ContentView.Bounds
            };
            thumbnailImageView = new UIImageView();
            thumbnailImageView.Layer.MasksToBounds = true;
            thumbnailImageView.Layer.CornerRadius  = 50;

            var blurEffect     = UIBlurEffect.FromStyle(UIBlurEffectStyle.ExtraLight);
            var vibrancyEffect = UIVibrancyEffect.FromBlurEffect(blurEffect);
            var blurView       = new UIVisualEffectView(blurEffect);
            var vibrancyView   = new UIVisualEffectView(vibrancyEffect);

            headingLabel = new UILabel()
            {
                Font            = UIFont.PreferredTitle1,
                TextAlignment   = UITextAlignment.Center,
                BackgroundColor = UIColor.Clear
            };

            subheadingLabel = new UILabel()
            {
                Font            = UIFont.PreferredSubheadline,
                TextAlignment   = UITextAlignment.Center,
                BackgroundColor = UIColor.Clear
            };

            // creat blur view
            vibrancyView.ContentView.Add(headingLabel);
            vibrancyView.ContentView.Add(subheadingLabel);
            vibrancyView.ContentView.Add(thumbnailImageView);
            subheadingLabel.TranslatesAutoresizingMaskIntoConstraints    = false;
            headingLabel.TranslatesAutoresizingMaskIntoConstraints       = false;
            thumbnailImageView.TranslatesAutoresizingMaskIntoConstraints = false;

            var labelViews = NSDictionary.FromObjectsAndKeys(new NSObject[] { subheadingLabel, headingLabel, vibrancyView, thumbnailImageView }, new NSObject[] { new NSString("subtitle"), new NSString("title"), new NSString("vibrancy"), new NSString("thumbnail") });

            vibrancyView.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-[title]-2-[subtitle]-|", 0, new NSDictionary(), labelViews));
            vibrancyView.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-[thumbnail]-|", 0, new NSDictionary(), labelViews));
            vibrancyView.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-[thumbnail(100)]-|", 0, new NSDictionary(), labelViews));
            vibrancyView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-[title(>=50)]-[thumbnail(100)]-|", 0, new NSDictionary(), labelViews));
            vibrancyView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-[subtitle(>=50)]-[thumbnail(100)]-|", 0, new NSDictionary(), labelViews));

            blurView.ContentView.Add(vibrancyView);
            vibrancyView.TranslatesAutoresizingMaskIntoConstraints = false;
            blurView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-0-[vibrancy]-0-|", 0, new NSDictionary(), labelViews));
            blurView.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-0-[vibrancy]-0-|", 0, new NSDictionary(), labelViews));

            // create ContentView
            ContentView.Add(imageView);
            ContentView.Add(blurView);

            imageView.TranslatesAutoresizingMaskIntoConstraints = false;
            blurView.TranslatesAutoresizingMaskIntoConstraints  = false;

            var viewsDictionary = NSDictionary.FromObjectsAndKeys(new NSObject[] { imageView, blurView }, new NSObject[] { new NSString("image"), new NSString("blur") });

            ContentView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-0-[image]-0-|", 0, new NSDictionary(), viewsDictionary));
            ContentView.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-0-[image]-0-|", 0, new NSDictionary(), viewsDictionary));
            ContentView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-0-[blur]-0-|", 0, new NSDictionary(), viewsDictionary));
            ContentView.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-0-[blur]-0-|", 0, new NSDictionary(), viewsDictionary));
        }
Beispiel #11
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            TableView.SeparatorEffect = UIVibrancyEffect.FromBlurEffect(UIBlurEffect.FromStyle(UIBlurEffectStyle.Light));
        }