本文整理汇总了C#中UISlider.AddTarget方法的典型用法代码示例。如果您正苦于以下问题:C# UISlider.AddTarget方法的具体用法?C# UISlider.AddTarget怎么用?C# UISlider.AddTarget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UISlider
的用法示例。
在下文中一共展示了UISlider.AddTarget方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}