public override void ViewDidLoad ()
		{
			// Applies style on specified element
			GunmetalTheme.Apply (View, UIDeviceOrientation.LandscapeLeft);
			GunmetalTheme.Apply (textInputView);
			GunmetalTheme.Apply (UISegmentedControl.Appearance);
			
			slider.Frame = new RectangleF (218, 410, 327, 24);

			var shadowLayer = this.CreateShadowWithFrame (new RectangleF (0, 0, 768, 5));
			View.Layer.AddSublayer (shadowLayer);

			bool showSwitchText = !UIDevice.CurrentDevice.CheckSystemVersion (7, 0);

			var onRect = new RectangleF (300, 280, 80, 36);
			var offRect = new RectangleF (390, 280, 80, 36);

			if (!showSwitchText) {
				onRect.X += 20;
				onRect.Width -= 20;
				offRect.Width -= 20;
			}
			
			var onSwitch = new SwitchOnOff (onRect);
			var offSwitch = new SwitchOnOff (offRect);

			onSwitch.ShowText (showSwitchText);
			offSwitch.ShowText (showSwitchText);

			onSwitch.SetOn (true);			
			offSwitch.SetOn (false);    
			
			progressBar = new PopoverProgressBar (new RectangleF (218, 340, 327, 24), ProgressBarColor.Blue);
			progressBar.SetProgress (0.5f);			

			var data = new [] { "Yes", "No", "Maybe" };
			var segment = new UISegmentedControl (data);
			segment.Frame = new RectangleF (250, 460, 250, 45);
			segment.SelectedSegment = 0;

			scrollView.AddSubviews (segment, onSwitch, offSwitch, progressBar);

			slider.ExclusiveTouch = true;

			greenButton.SetBackgroundImage (GunmetalTheme.SharedTheme.ButtonImage(ButtonType.Confirm, UIControlState.Normal), UIControlState.Normal);
			greenButtonPressed.SetBackgroundImage (GunmetalTheme.SharedTheme.ButtonImage(ButtonType.Confirm, UIControlState.Highlighted), UIControlState.Normal);

			blackButton.SetBackgroundImage (GunmetalTheme.SharedTheme.ButtonImage(ButtonType.Black, UIControlState.Normal), UIControlState.Normal);
			blackButtonPressed.SetBackgroundImage (GunmetalTheme.SharedTheme.ButtonImage(ButtonType.Black, UIControlState.Highlighted), UIControlState.Normal);

			redButton.SetBackgroundImage (GunmetalTheme.SharedTheme.ButtonImage(ButtonType.Cancel, UIControlState.Normal), UIControlState.Normal);
			redButtonPressed.SetBackgroundImage (GunmetalTheme.SharedTheme.ButtonImage(ButtonType.Cancel, UIControlState.Highlighted), UIControlState.Normal);

			grayButton.SetBackgroundImage (GunmetalTheme.SharedTheme.ButtonImage(ButtonType.Aluminium, UIControlState.Normal), UIControlState.Normal);
			grayButtonPressed.SetBackgroundImage (GunmetalTheme.SharedTheme.ButtonImage(ButtonType.Aluminium, UIControlState.Highlighted), UIControlState.Normal);

			base.ViewDidLoad ();
		}
示例#2
0
        public override void ViewDidLoad()
        {
            // Applies style on specified element
            GunmetalTheme.Apply(View, UIDeviceOrientation.LandscapeLeft);
            GunmetalTheme.Apply(textInputView);
            GunmetalTheme.Apply(UISegmentedControl.Appearance);

            slider.Frame = new RectangleF(218, 410, 327, 24);

            var shadowLayer = this.CreateShadowWithFrame(new RectangleF(0, 0, 768, 5));

            View.Layer.AddSublayer(shadowLayer);

            bool showSwitchText = !UIDevice.CurrentDevice.CheckSystemVersion(7, 0);

            var onRect  = new RectangleF(300, 280, 80, 36);
            var offRect = new RectangleF(390, 280, 80, 36);

            if (!showSwitchText)
            {
                onRect.X      += 20;
                onRect.Width  -= 20;
                offRect.Width -= 20;
            }

            var onSwitch  = new SwitchOnOff(onRect);
            var offSwitch = new SwitchOnOff(offRect);

            onSwitch.ShowText(showSwitchText);
            offSwitch.ShowText(showSwitchText);

            onSwitch.SetOn(true);
            offSwitch.SetOn(false);

            progressBar = new PopoverProgressBar(new RectangleF(218, 340, 327, 24), ProgressBarColor.Blue);
            progressBar.SetProgress(0.5f);

            var data    = new [] { "Yes", "No", "Maybe" };
            var segment = new UISegmentedControl(data);

            segment.Frame           = new RectangleF(250, 460, 250, 45);
            segment.SelectedSegment = 0;

            scrollView.AddSubviews(segment, onSwitch, offSwitch, progressBar);

            slider.ExclusiveTouch = true;

            greenButton.SetBackgroundImage(GunmetalTheme.SharedTheme.ButtonImage(ButtonType.Confirm, UIControlState.Normal), UIControlState.Normal);
            greenButtonPressed.SetBackgroundImage(GunmetalTheme.SharedTheme.ButtonImage(ButtonType.Confirm, UIControlState.Highlighted), UIControlState.Normal);

            blackButton.SetBackgroundImage(GunmetalTheme.SharedTheme.ButtonImage(ButtonType.Black, UIControlState.Normal), UIControlState.Normal);
            blackButtonPressed.SetBackgroundImage(GunmetalTheme.SharedTheme.ButtonImage(ButtonType.Black, UIControlState.Highlighted), UIControlState.Normal);

            redButton.SetBackgroundImage(GunmetalTheme.SharedTheme.ButtonImage(ButtonType.Cancel, UIControlState.Normal), UIControlState.Normal);
            redButtonPressed.SetBackgroundImage(GunmetalTheme.SharedTheme.ButtonImage(ButtonType.Cancel, UIControlState.Highlighted), UIControlState.Normal);

            grayButton.SetBackgroundImage(GunmetalTheme.SharedTheme.ButtonImage(ButtonType.Aluminium, UIControlState.Normal), UIControlState.Normal);
            grayButtonPressed.SetBackgroundImage(GunmetalTheme.SharedTheme.ButtonImage(ButtonType.Aluminium, UIControlState.Highlighted), UIControlState.Normal);

            base.ViewDidLoad();
        }
		public override void ViewDidLoad ()
		{
			// Applies style on specified element
			GunmetalTheme.Apply (View);
			GunmetalTheme.Apply (textInput);

			var shadowLayer = CreateShadowWithFrame (new RectangleF (0, 0, 320, 5));

			View.Layer.AddSublayer (shadowLayer);

			var button = new UIButton (UIButtonType.Custom) {
				Frame = new RectangleF (1, 1, 29, 29),
			};

			button.SetBackgroundImage (UIImage.FromFile ("GunmetalImages/navbar-button.png"), UIControlState.Normal);
			
			var barButtonItem = new UIBarButtonItem (button);
			NavigationItem.LeftBarButtonItem = barButtonItem;
									
			progressBar = new PopoverProgressBar (new RectangleF (10, 30, 300, 24), ProgressBarColor.Blue);
			progressBar.SetProgress (0.5f);   
						
			slider = new UISlider (new RectangleF (10, 100, 300, 24)) {
				MaxValue = 1,
				MinValue = 0,
				Value = 0.5f
			};

			slider.ValueChanged += (sender, e) => ValueChanged ();

			bool showSwitchText = !UIDevice.CurrentDevice.CheckSystemVersion (7, 0);

			var onRect = new RectangleF (70, 150, 80, 36);
			var offRect = new RectangleF (180, 150, 80, 36);

			if (!showSwitchText) {
				onRect.X += 20;
				onRect.Width -= 20;
				offRect.Width -= 20;
			}

			var onSwitch = new SwitchOnOff (onRect);
			var offSwitch = new SwitchOnOff (offRect);

			onSwitch.ShowText (showSwitchText);
			offSwitch.ShowText (showSwitchText);
					
			onSwitch.SetOn (true);
			offSwitch.SetOn (false);

			var segments = new [] { "Yes", "No", "Maybe" };
			var segmentControl = new UISegmentedControl (segments) {
				Frame = new RectangleF (40, 210, 250, 45),
				SelectedSegment = 0
			};
			
			scrollView.AddSubviews (progressBar, slider, onSwitch, offSwitch, segmentControl);

			textInput.WeakDelegate = this;
			textInput.ReturnKeyType = UIReturnKeyType.Done;
			textInput.LeftView = new UIView (new RectangleF (0, 0, 5, 30));
			textInput.LeftViewMode = UITextFieldViewMode.Always;

			base.ViewDidLoad ();
		}
		private void InitSubviews ()
		{
			FitpulseTheme.Apply (View);

			scrollView = new UIScrollView (UIScreen.MainScreen.Bounds);
			Add (scrollView);

			if (UISwitch.Appearance.RespondsToSelector (new Selector ("onImage"))) {
			} else {
				bool showSwitchText = !UIDevice.CurrentDevice.CheckSystemVersion (7, 0);
				var onRect = new CGRect (72, 20, 76, 42);
				var offRect = new CGRect (176, 20, 76, 42);

				if (!showSwitchText) {
				  onRect.X += 20;
				  onRect.Width -= 20;
				  offRect.Width -= 20;
				}

				var onSwitch = new SwitchOnOff (onRect);
				onSwitch.SetOn (true);

				var offSwitch = new SwitchOnOff (offRect);
				offSwitch.SetOn (false);

				onSwitch.ShowText (showSwitchText);
				offSwitch.ShowText (showSwitchText);

				scrollView.AddSubviews (onSwitch, offSwitch);
			}

			progressBar = new PercentageProgressBar (new CGRect (20, 68, 280, 24));
			progressBar.Progress = 0.5f;

			scrollView.Add (progressBar);

			var loadingLabel = new UILabel (new CGRect (118, 91, 84, 19));
			loadingLabel.Text = "Loading...";
			loadingLabel.Font = UIFont.BoldSystemFontOfSize (15);
			loadingLabel.TextColor = UIColor.FromRGB (135, 141, 138);
			loadingLabel.BackgroundColor = UIColor.Clear;
			loadingLabel.TextAlignment = UITextAlignment.Center;

			scrollView.Add (loadingLabel);		

			slider = new UISlider (new CGRect (18, 121, 284, 23));
			slider.MinValue = 0;
			slider.MaxValue = 1;
			slider.Value = 0.5f;
			slider.ValueChanged += (sender, e) => {
				progressBar.Progress = slider.Value; };

			scrollView.Add (slider);	

			var uiSegmentedControl = new UISegmentedControl (new [] {"Yes", "No", "Maybe"}) {
				SelectedSegment = 0
			};

			FitpulseTheme.Apply (uiSegmentedControl);
			uiSegmentedControl.SetWidth (80.0f, 0);
			uiSegmentedControl.SetWidth (80.0f, 1);				
			
			uiSegmentedControl.Frame = new CGRect (26, 161, 268, 44);

			scrollView.Add (uiSegmentedControl);

			textField = new UITextField (new CGRect (20, 221, 280, 31));
			textField.LeftView = new UIView (new CGRect (0, 0, 5, 31));
			textField.LeftViewMode = UITextFieldViewMode.Always;
			textField.Font = UIFont.SystemFontOfSize (14);
			textField.TextColor = UIColor.White;
			textField.Background = UIImage.FromFile ("text-input.png");
			textField.VerticalAlignment = UIControlContentVerticalAlignment.Center;
			textField.Placeholder = "Text";
			FitpulseTheme.Apply (textField);

			textField.Delegate = new TextFieldDelegate ();

			scrollView.Add (textField);

			var leftTopButton = Buttons.ElementsButton ("Button", FitpulseTheme.SharedTheme.GrayButtonImage);
			var rightTopButton = Buttons.ElementsButton ("Button", FitpulseTheme.SharedTheme.GrayPressedButtonImage);

			var leftBottomButton = Buttons.ElementsButton ("Button", FitpulseTheme.SharedTheme.BlueButtonImage);
			var rightBottomButton = Buttons.ElementsButton ("Button", FitpulseTheme.SharedTheme.BluePressedButtonImage);

			leftBottomButton.SetTitleColor (UIColor.White, UIControlState.Normal);
			leftBottomButton.SetTitleColor (UIColor.DarkGray, UIControlState.Highlighted);
			rightBottomButton.SetTitleColor (UIColor.White, UIControlState.Normal);
			rightBottomButton.SetTitleColor (UIColor.DarkGray, UIControlState.Highlighted);

			leftBottomButton.SetTitleShadowColor (UIColor.DarkGray, UIControlState.Normal);
			leftBottomButton.SetTitleShadowColor (UIColor.Gray, UIControlState.Highlighted);
			rightBottomButton.SetTitleShadowColor (UIColor.DarkGray, UIControlState.Normal);
			rightBottomButton.SetTitleShadowColor (UIColor.Gray, UIControlState.Highlighted);

			leftTopButton.Frame = new CGRect (20, 268, 126, 42);
			leftBottomButton.Frame = new CGRect (20, 318, 126, 42);
			rightTopButton.Frame = new CGRect (174, 268, 126, 42);
			rightBottomButton.Frame = new CGRect (174, 318, 126, 42);

			scrollView.AddSubviews (leftTopButton, leftBottomButton, rightTopButton, rightBottomButton);
			
		}
示例#5
0
        public override void ViewDidLoad()
        {
            // Applies style on specified element
            GunmetalTheme.Apply(View);
            GunmetalTheme.Apply(textInput);

            var shadowLayer = CreateShadowWithFrame(new RectangleF(0, 0, 320, 5));

            View.Layer.AddSublayer(shadowLayer);

            var button = new UIButton(UIButtonType.Custom)
            {
                Frame = new RectangleF(1, 1, 29, 29),
            };

            if (GunmetalTheme.IsIOS7)
            {
                button.SetBackgroundImage(UIImage.FromFile("action_menu.png"), UIControlState.Normal);
            }
            else
            {
                button.SetBackgroundImage(UIImage.FromFile("GunmetalImages/navbar-button.png"), UIControlState.Normal);
            }


            var barButtonItem = new UIBarButtonItem(button);

            NavigationItem.LeftBarButtonItem = barButtonItem;

            progressBar = new PopoverProgressBar(new RectangleF(10, 30, 300, 24), ProgressBarColor.Blue);
            progressBar.SetProgress(0.5f);

            slider = new UISlider(new RectangleF(10, 100, 300, 24))
            {
                MaxValue = 1,
                MinValue = 0,
                Value    = 0.5f
            };

            slider.ValueChanged += (sender, e) => ValueChanged();

            bool showSwitchText = !UIDevice.CurrentDevice.CheckSystemVersion(7, 0);

            var onRect  = new RectangleF(70, 150, 80, 36);
            var offRect = new RectangleF(180, 150, 80, 36);

            if (!showSwitchText)
            {
                onRect.X      += 20;
                onRect.Width  -= 20;
                offRect.Width -= 20;
            }

            var onSwitch  = new SwitchOnOff(onRect);
            var offSwitch = new SwitchOnOff(offRect);

            onSwitch.ShowText(showSwitchText);
            offSwitch.ShowText(showSwitchText);

            onSwitch.SetOn(true);
            offSwitch.SetOn(false);

            var segments       = new [] { "Yes", "No", "Maybe" };
            var segmentControl = new UISegmentedControl(segments)
            {
                Frame           = new RectangleF(40, 210, 250, 45),
                SelectedSegment = 0
            };

            scrollView.AddSubviews(progressBar, slider, onSwitch, offSwitch, segmentControl);

            textInput.WeakDelegate  = this;
            textInput.ReturnKeyType = UIReturnKeyType.Done;
            textInput.LeftView      = new UIView(new RectangleF(0, 0, 5, 30));
            textInput.LeftViewMode  = UITextFieldViewMode.Always;

            base.ViewDidLoad();
        }