Exemplo n.º 1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();


            JVMenuHelper.RemoveLayerFromView(ContainerView);

            // gradient background color
            var newGradient = (CAGradientLayer)CAGradientLayer.Create();

            newGradient.Frame = this.View.Frame;

            var firstColor  = JVMenuHelper.ColorWithHexString("EF4DB6");
            var secondColor = JVMenuHelper.ColorWithHexString("C643FC");

            newGradient.Colors = new CoreGraphics.CGColor[] { firstColor.CGColor, secondColor.CGColor };


            ContainerView.Layer.InsertSublayer(newGradient, 0);

            Image           = JVMenuHelper.ChangeImageColor(UIImage.FromBundle("ask_question-48"), UIColor.Black);
            ImageView.Image = Image;

            Label.Text = @"Help?";
        }
        public void AddNightFallGradient()
        {
            CAGradientLayer gradient = CAGradientLayer.Create() as CAGradientLayer;

            gradient.Frame  = View.Bounds;
            gradient.Colors = new MonoTouch.CoreGraphics.CGColor[] { UIColor.FromRGB(0, 0, 0).CGColor, UIColor.FromRGB(0, 71, 93).CGColor };
            View.Layer.InsertSublayer(gradient, 0);
        }
Exemplo n.º 3
0
        UIView createContainerView()
        {
            if (ContainerView == null)
            {
                ContainerView = new UIView(new CGRect(0, 0, 300, 150));
            }

            CGSize screenSize = countScreenSize();
            CGSize dialogSize = countDialogSize();

            // For the black background
            Frame = new CGRect(0, 0, screenSize.Width, screenSize.Height);

            // This is the dialog's container; we attach the custom content and the buttons to this one
            UIView dialogContainer = new UIView(new CGRect((screenSize.Width - dialogSize.Width) / 2, (screenSize.Height - dialogSize.Height) / 2, dialogSize.Width, dialogSize.Height));

            // First, we style the dialog to match the iOS7 UIAlertView >>>
            CAGradientLayer gradient = (CAGradientLayer)CAGradientLayer.Create();

            gradient.Frame  = dialogContainer.Bounds;
            gradient.Colors = new CGColor[] { new CGColor(new nfloat(218.0 / 255.0), new nfloat(218.0 / 255.0), new nfloat(218.0 / 255.0), new nfloat(1.0f)),
                                              new CGColor(new nfloat(233.0 / 255.0), new nfloat(233.0 / 255.0), new nfloat(233.0 / 255.0), new nfloat(1.0f)),
                                              new CGColor(new nfloat(218.0 / 255.0), new nfloat(218.0 / 255.0), new nfloat(218.0 / 255.0), new nfloat(1.0f)) };

            float cornerRadius = kCustomIOSAlertViewCornerRadius;

            gradient.CornerRadius = cornerRadius;
            dialogContainer.Layer.InsertSublayer(gradient, 0);

            dialogContainer.Layer.CornerRadius  = cornerRadius;
            dialogContainer.Layer.BorderColor   = new CGColor(new nfloat(198.0 / 255.0), new nfloat(198.0 / 255.0), new nfloat(198.0 / 255.0), new nfloat(1.0f));
            dialogContainer.Layer.BorderWidth   = 1;
            dialogContainer.Layer.ShadowRadius  = cornerRadius + 5;
            dialogContainer.Layer.ShadowOpacity = 0.1f;
            dialogContainer.Layer.ShadowOffset  = new CGSize(0 - (cornerRadius + 5) / 2, 0 - (cornerRadius + 5) / 2);
            dialogContainer.Layer.ShadowColor   = UIColor.Black.CGColor;
            dialogContainer.Layer.ShadowPath    = UIBezierPath.FromRoundedRect(dialogContainer.Bounds, dialogContainer.Layer.CornerRadius).CGPath;

            // There is a line above the button
            UIView lineView = new UIView(new CGRect(0, dialogContainer.Bounds.Size.Height - buttonHeight - buttonSpacerHeight, dialogContainer.Bounds.Size.Width, buttonSpacerHeight));

            lineView.BackgroundColor = new UIColor(new nfloat(198.0 / 255.0), new nfloat(198.0 / 255.0), new nfloat(198.0 / 255.0), new nfloat(1.0f));
            dialogContainer.AddSubview(lineView);
            // ^^^

            // Add the custom container if there is any
            dialogContainer.AddSubview(ContainerView);

            // Add the buttons too
            addButtonsToView(dialogContainer);

            return(dialogContainer);
        }
        /// <summary>
        /// ViewDidLoad
        /// </summary>
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.View.BackgroundColor = UIColor.Clear;

            this.View.AutoresizingMask  = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
            this.View.AutosizesSubviews = true;

            ContainerView = new UIView(this.View.Frame);
            ContainerView.AutoresizingMask  = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
            ContainerView.AutosizesSubviews = true;

            // gradient background color
            Gradient       = (CAGradientLayer)CAGradientLayer.Create();
            Gradient.Frame = this.View.Frame;

            var firstColor  = JVMenuHelper.ColorWithHexString("52EDC7");
            var secondColor = JVMenuHelper.ColorWithHexString("5AC8FB");

            Gradient.Colors = new CoreGraphics.CGColor[] { firstColor.CGColor, secondColor.CGColor };


            ContainerView.Layer.InsertSublayer(Gradient, 0);

            Image           = JVMenuHelper.ChangeImageColor(JVMenuPopoverConfig.SharedInstance.MenuImage, UIColor.Black);
            ImageView       = new UIImageView(new CGRect(this.View.Frame.Size.Width / 2 - this.Image.Size.Width / 2, this.View.Frame.Size.Height / 2 - 30, this.Image.Size.Width, this.Image.Size.Height));
            ImageView.Image = Image;

            ContainerView.Add(ImageView);

            Label               = new UILabel(new CGRect(this.View.Frame.Size.Width / 2 - 110, this.View.Frame.Size.Height / 2 - 20, 220, 60));
            Label.TextColor     = UIColor.Black.ColorWithAlpha(0.6f);
            Label.TextAlignment = UITextAlignment.Center;
            Label.Font          = UIFont.FromName("HelveticaNeue", 20);
            Label.TextColor     = UIColor.Black;
            Label.Text          = @"Home";

            ContainerView.Add(Label);

            this.View.Add(ContainerView);
        }
Exemplo n.º 5
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var fontName = "Open Sans";

            View.Subviews.OfType <UIButton>().Each((button, n) => {
                button.TitleLabel.Font = UIFont.FromName(fontName, 22f);
                // First five buttons are the title tracks
                if (n < 5)
                {
                    SetHighlightedTrack(button, n);
                    mainViewController.musicOption.MusicItems[n].PropertyChanged += (sender, ev) => {
                        SetHighlightedTrack(button, n);
                    };
                    button.TouchUpInside += (send, ea) => {
                        mainViewController.PlayAudio(mainViewController.musicOption.MusicItems[n].Path);
                        mainViewController.musicOption.SetDefaultMusic(n);
                    };
                }
            });

            CAGradientLayer gradient = CAGradientLayer.Create() as CAGradientLayer;

            gradient.Frame  = View.Bounds;
            gradient.Colors = new MonoTouch.CoreGraphics.CGColor[] { UIColor.FromRGB(0, 0, 0).CGColor, UIColor.FromRGB(0, 71, 93).CGColor };
            View.Layer.InsertSublayer(gradient, 0);

            muteButton.TitleLabel.Font = UIFont.FromName(fontName, 22f);
            musicLabel.Font            = UIFont.FromName(fontName, 16f);
            muteSwitch.On            = SettingsHelper.Mute;
            muteSwitch.ValueChanged += (object sender, EventArgs e) => {
                mainViewController.MuteAudio(muteSwitch.On);
            };
            muteButton.SetTitleColor(highlightedColor, UIControlState.Highlighted);
            muteButton.TouchUpInside += (sender, e) => {
                muteSwitch.On = !muteSwitch.On;
                mainViewController.MuteAudio(muteSwitch.On);
            };
        }
Exemplo n.º 6
0
        void RenderGradientLayer(GradientView element)
        {
            if (element.Bounds.Height > 0)
            {
                var startColor = element.StartColor.ToCGColor();
                var endColor   = element.EndColor.ToCGColor();

                if (hasGradientLayer)
                {
                    Control.Layer.Sublayers[0].RemoveFromSuperLayer();
                }

                var gradientLayer = (CAGradientLayer)CAGradientLayer.Create();
                gradientLayer.Frame  = new CGRect(0, 0, (nfloat)element.Bounds.Size.Width, (nfloat)element.Bounds.Size.Height);
                gradientLayer.Colors = new CGColor[] { startColor, endColor };
                if (element.Orientation == GradientOrientation.LeftRight)
                {
                    gradientLayer.StartPoint = new CGPoint(0, 0);
                    gradientLayer.EndPoint   = new CGPoint(1, 0);
                }
                Control.Layer.InsertSublayer(gradientLayer, 0);
                hasGradientLayer = true;
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.Subviews.OfType <UIButton>().Each((button, n) => {
                button.TitleLabel.Font = UIFont.FromName("Open Sans", 18f);
            });

            View.Subviews.OfType <UILabel>().Each((label, n) => {
                label.Font = UIFont.FromName("Open Sans", 16f);
            });

            CAGradientLayer gradient = CAGradientLayer.Create() as CAGradientLayer;

            gradient.Frame  = View.Bounds;
            gradient.Colors = new MonoTouch.CoreGraphics.CGColor[] { UIColor.FromRGB(0, 0, 0).CGColor, UIColor.FromRGB(0, 71, 93).CGColor };
            View.Layer.InsertSublayer(gradient, 0);

            if (UIDevice.CurrentDevice.CheckSystemVersion(6, 0))
            {
                twitterLink.Hidden = true;
                socialLink.Hidden  = false;
            }
            else
            {
                twitterLink.Hidden = false;
                socialLink.Hidden  = true;
            }

            twitterLink.TouchUpInside += (sender, e) => {
                var tweet = new TWTweetComposeViewController();
                tweet.SetInitialText(mainViewController.GetSocialCountdownString());
                PresentViewController(tweet, true, null);
            };

            socialLink.TouchUpInside += (sender, e) => {
                var message = mainViewController.GetSocialCountdownString();
                var social  = new UIActivityViewController(new NSObject[] { new NSString(message) },
                                                           new UIActivity[] { new UIActivity() });
                PresentViewController(social, true, null);
            };

            websiteLink.TouchUpInside += (sender, e) => {
                var webUrl = NSUrl.FromString("http://daysuntilxmas.com");
                UIApplication.SharedApplication.OpenUrl(webUrl);
            };

            reviewLink.TouchUpInside += (sender, e) => {
                var id        = "yourAppId";
                var itunesUrl = NSUrl.FromString(String.Format("itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id={0}", id));
                var webUrl    = NSUrl.FromString(String.Format("http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id={0}&pageNumber=0&sortOrdering=1&type=Purple+Software&mt=8", id));
                if (UIApplication.SharedApplication.CanOpenUrl(itunesUrl))
                {
                    UIApplication.SharedApplication.OpenUrl(itunesUrl);
                }
                else
                {
                    UIApplication.SharedApplication.OpenUrl(webUrl);
                }
            };

            // Perform any additional setup after loading the view, typically from a nib.
        }
Exemplo n.º 8
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //build the shared menu
            var menuItem = new List <JVMenuItem>()
            {
                new JVMenuActionItem()
                {
                    //View exisiting view controller, will be reused everytime the item is selected
                    Icon    = UIImage.FromBundle(@"home-48"),
                    Title   = @"Home",
                    Command = () =>
                    {
                        var uiAlert = new UIAlertView("Menu Item Clicked", "Home", null, "OK", null);
                        uiAlert.Show();
                    },
                },
                new JVMenuActionItem()
                {
                    //New view controller, will be reused everytime the item is selected
                    Icon    = UIImage.FromBundle(@"about-48"),
                    Title   = @"About Us",
                    Command = () =>
                    {
                        var uiAlert = new UIAlertView("Menu Item Clicked", "About Us", null, "OK", null);
                        uiAlert.Show();
                    },
                },
                new JVMenuActionItem()
                {
                    //New view controller, will be reused everytime the item is selected
                    Icon    = UIImage.FromBundle(@"settings-48"),
                    Title   = @"Our Service",
                    Command = () =>
                    {
                        var uiAlert = new UIAlertView("Menu Item Clicked", "Our Service", null, "OK", null);
                        uiAlert.Show();
                    },
                },
                new JVMenuActionItem()
                {
                    //New view controller, will be reused everytime the item is selected
                    Icon    = UIImage.FromBundle(@"business_contact-48"),
                    Title   = @"Contact Us",
                    Command = () =>
                    {
                        var uiAlert = new UIAlertView("Menu Item Clicked", "Contact Us", null, "OK", null);
                        uiAlert.Show();
                    },
                },
                new JVMenuActionItem
                {
                    //New view controller, will be recreated afresh everytime the item is selected
                    Icon    = UIImage.FromBundle(@"ask_question-48"),
                    Title   = @"Help?",
                    Command = () =>
                    {
                        var uiAlert = new UIAlertView("Menu Item Clicked", "Help?", null, "OK", null);
                        uiAlert.Show();
                    },
                },
                new JVMenuActionItem()
                {
                    //Action is called, on the UI thread, everytime the item is selected
                    Icon    = UIImage.FromBundle(@"ask_question-48"),
                    Title   = @"Logout",
                    Command = () =>
                    {
                        var uiAlert = new UIAlertView("Menu Item Clicked", "You clicked logout", null, "OK", null);
                        uiAlert.Show();
                    },
                },
            };

            _menuController = new JVMenuPopoverViewController(menuItem);

            this.View.BackgroundColor = UIColor.Clear;

            ContainerView = new UIView(this.View.Frame);

            // gradient background color
            Gradient       = (CAGradientLayer)CAGradientLayer.Create();
            Gradient.Frame = this.View.Frame;

            var firstColor  = JVMenuHelper.ColorWithHexString("52EDC7");
            var secondColor = JVMenuHelper.ColorWithHexString("5AC8FB");

            Gradient.Colors = new CoreGraphics.CGColor[] { firstColor.CGColor, secondColor.CGColor };


            ContainerView.Layer.InsertSublayer(Gradient, 0);



            this.View.Add(ContainerView);
        }