当前位置: 首页>>代码示例>>C#>>正文


C# UISlider.SetMinTrackImage方法代码示例

本文整理汇总了C#中UISlider.SetMinTrackImage方法的典型用法代码示例。如果您正苦于以下问题:C# UISlider.SetMinTrackImage方法的具体用法?C# UISlider.SetMinTrackImage怎么用?C# UISlider.SetMinTrackImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UISlider的用法示例。


在下文中一共展示了UISlider.SetMinTrackImage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CustomSliderControl

        UIControl CustomSliderControl()
        {
            var cslider = new UISlider (new RectangleF (174f, 12f, 120f, 7f)){
                BackgroundColor = UIColor.Clear,
                MinValue = 0f,
                MaxValue = 100f,
                Continuous = true,
                Value = 50f,
                Tag = kViewTag
            };

            var left = UIImage.FromFile ("images/orangeslide.png");
            left = left.StretchableImage (10, 0);
            var right = UIImage.FromFile ("images/yellowslide.png");
            right = right.StretchableImage (10, 0);

            cslider.SetThumbImage (UIImage.FromFile ("images/slider_ball.png"), UIControlState.Normal);
            cslider.SetMinTrackImage (left, UIControlState.Normal);
            cslider.SetMaxTrackImage (right, UIControlState.Normal);

            cslider.ValueChanged += delegate {
                Console.WriteLine ("New value {0}", cslider.Value);
            };
            return cslider;
        }
开发者ID:CVertex,项目名称:monotouch-samples,代码行数:25,代码来源:ControlsViewController.xib.cs

示例2: Initialize


//.........这里部分代码省略.........
            // Make sure the text label is over all other subviews
            DetailTextLabel.RemoveFromSuperview();
            ImageView.RemoveFromSuperview();
            AddSubview(DetailTextLabel);
            AddSubview(ImageView);

			TextField = new UITextField();
			TextField.Layer.CornerRadius = 8;
			TextField.Alpha = 0;
			TextField.BackgroundColor = UIColor.FromRGBA(0.8f, 0.8f, 0.8f, 0.075f);
			TextField.Font = UIFont.FromName("HelveticaNeue-Light", 16);
			TextField.TextColor = UIColor.White;
			TextField.VerticalAlignment = UIControlContentVerticalAlignment.Center;
			TextField.ReturnKeyType = UIReturnKeyType.Done;
			AddSubview(TextField);

			TitleLabel = new UILabel();
			TitleLabel.Text = "Position";
			TitleLabel.Font = UIFont.FromName("HelveticaNeue-Light", 14);
			TitleLabel.TextColor = UIColor.FromRGB(0.8f, 0.8f, 0.8f);
			AddSubview(TitleLabel);

			// Add padding to text field
			UIView paddingView = new UIView(new RectangleF(0, 0, 4, 20));
			TextField.LeftView = paddingView;
			TextField.LeftViewMode = UITextFieldViewMode.Always;

			// Make sure the Done key closes the keyboard
			TextField.ShouldReturn = (a) => {
				if(OnChangeMarkerName != null)
					OnChangeMarkerName(MarkerId, TextField.Text);

				TextLabel.Text = TextField.Text;
				TextField.ResignFirstResponder();
				return true;
			};

            IndexTextLabel = new UILabel();
			IndexTextLabel.BackgroundColor = UIColor.FromRGBA(1, 0, 0, 0.7f);
			IndexTextLabel.Font = UIFont.FromName("HelveticaNeue", 16);
			IndexTextLabel.TextColor = UIColor.White;
            IndexTextLabel.TextAlignment = UITextAlignment.Center;
            IndexTextLabel.HighlightedTextColor = UIColor.White;
            AddSubview(IndexTextLabel);

			DeleteButton = new SessionsSemiTransparentRoundButton();
			DeleteButton.Alpha = 0;
			DeleteButton.GlyphImageView.Image = UIImage.FromBundle("Images/Player/remove");
			DeleteButton.TouchUpInside += HandleOnDeleteButtonClick;
			AddSubview(DeleteButton);

			PunchInButton = new SessionsSemiTransparentRoundButton();
			PunchInButton.Alpha = 0;
			PunchInButton.GlyphImageView.Image = UIImage.FromBundle("Images/Player/punch_in");
			PunchInButton.TouchUpInside += HandleOnPunchInButtonClick;
			AddSubview(PunchInButton);

//			UndoButton = new SessionsSemiTransparentRoundButton();
//			UndoButton.Alpha = 0;
//			UndoButton.GlyphImageView.Image = UIImage.FromBundle("Images/Player/undo");
//			UndoButton.TouchUpInside += HandleOnUndoButtonClick;
//			AddSubview(UndoButton);

            // Make sure the text label is over all other subviews
            TextLabel.RemoveFromSuperview();
            AddSubview(TextLabel);

			Slider = new UISlider(new RectangleF(0, 0, 10, 10));
			Slider.ExclusiveTouch = true;
			Slider.Alpha = 0;
			Slider.SetThumbImage(UIImage.FromBundle("Images/Sliders/thumb"), UIControlState.Normal);
			Slider.SetMinTrackImage(UIImage.FromBundle("Images/Sliders/slider2").CreateResizableImage(new UIEdgeInsets(0, 8, 0, 8), UIImageResizingMode.Tile), UIControlState.Normal);
			Slider.SetMaxTrackImage(UIImage.FromBundle("Images/Sliders/slider_gray").CreateResizableImage(new UIEdgeInsets(0, 8, 0, 8), UIImageResizingMode.Tile), UIControlState.Normal);
			Slider.ValueChanged += (sender, e) =>
			{
				_sliderValue = Slider.Value;
				OnChangeMarkerPosition(MarkerId, Slider.Value);
			};
			Slider.TouchDown += (sender, e) => {
				//Tracing.Log("MarkerTableViewCell - TouchDown");
				// There's a bug in UISlider inside a UITableView inside a UIScrollView; the table view offset will change when changing slider value
				var tableView = (SessionsTableView)GetTableView();
				tableView.BlockContentOffsetChange = true;
			};
			Slider.TouchUpInside += (sender, e) => {
				//Tracing.Log("MarkerTableViewCell - TouchUpInside");
				var tableView = (SessionsTableView)GetTableView();
				tableView.BlockContentOffsetChange = false;

				// Take the last value from ValueChanged to prevent getting a slightly different value when the finger leaves the screen
				OnSetMarkerPosition(MarkerId, _sliderValue); 
			};
			AddSubview(Slider);

//            SecondaryMenuBackground = new UIView();
//            SecondaryMenuBackground.BackgroundColor = UIColor.White;
//            SecondaryMenuBackground.Frame = new RectangleF(UIScreen.MainScreen.Bounds.Width, 4, 188, 44);
//            //SecondaryMenuBackground.Alpha = 0;
//            AddSubview(SecondaryMenuBackground);
        }
开发者ID:pascalfr,项目名称:MPfm,代码行数:101,代码来源:MPfmMarkerTableViewCell.cs

示例3: LoadContent

        public void LoadContent()
        {
            this.BackgroundColor = UIColor.Clear;
            this.UserInteractionEnabled = true;

            if (_label == null || _slider == null)
            {
                /*foreach (UIView subview in this.Subviews)
                {
                    subview.PerformSelector(new MonoTouch.ObjCRuntime.Selector("removeFromSuperview"), subview, 0);
                }*/

                _label = new MBSliderLabel(RectangleF.Empty);
                _label.AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin;
                _label.TextColor = UIColor.White;
                _label.TextAlignment = UITextAlignment.Center;
                _label.BackgroundColor = UIColor.Clear;
                _label.Font = UIFont.SystemFontOfSize(24);
                _label.Text = "Slide";
                this.AddSubview(_label);
                _label.Animated = true;

                _slider = new UISlider(RectangleF.Empty);
                _slider.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
                PointF ctr = _slider.Center;
                RectangleF sliderFrame = _slider.Frame;
                sliderFrame.Width -= 4; //each "edge" of the track is 2 pixels wide
                _slider.Frame = sliderFrame;
                _slider.Center = ctr;
                _slider.BackgroundColor = UIColor.Clear;
                UIImage thumbImage = this.ThumbWithColor(UIColor.FromRGBA(200, 200, 200, 1));
                _slider.SetThumbImage(thumbImage, UIControlState.Normal);

                UIImage clearImage = this.ClearPixel();
                _slider.SetMaxTrackImage(clearImage, UIControlState.Normal);
                _slider.SetMinTrackImage(clearImage, UIControlState.Normal);

                _slider.MinValue = 0.0f;
                _slider.MaxValue = 1.0f;
                _slider.Continuous = true;
                _slider.Value = 0.0f;
                this.AddSubview (_slider);

                // Set the slider action methods
                _slider.AddTarget (sliderUp, UIControlEvent.TouchUpInside);
                _slider.AddTarget (sliderUp, UIControlEvent.TouchUpOutside);
                _slider.AddTarget (sliderDown, UIControlEvent.TouchDown);
                _slider.AddTarget (sliderChanged, UIControlEvent.ValueChanged);
            }
        }
开发者ID:RTodorov,项目名称:MBSliderView-Xamarin-iOS,代码行数:50,代码来源:MBSliderView.cs


注:本文中的UISlider.SetMinTrackImage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。