码迷,mamicode.com
首页 > 其他好文 > 详细

第五篇 - UIStepper

时间:2016-03-17 12:43:45      阅读:163      评论:0      收藏:0      [点我收藏+]

标签:

初始化

UIStepper *stepper = [[UIStepper alloc] init];

添加事件

[_stepper addTarget:self action:@selector(valueChange:) forControlEvents:UIControlEventValueChanged];
- (void)valueChange:(UIStepper *)stepper{
    
    _valueLb.text = [NSString stringWithFormat:@"%lf",stepper.value];
    NSLog(@"%lf",stepper.value);
}

 

//
  @class UIButton, UIImageView;
//
//NS_CLASS_AVAILABLE_IOS(5_0) __TVOS_PROHIBITED @interface UIStepper : UIControl
//
//设置控制器值是否连续触发变化
//若设置为YES,则长按会连续触发变化,若设置为NO,只有在按击结束后,才会触发。
  @property(nonatomic,getter=isContinuous) BOOL continuous; // if YES, value change events are sent any time the value changes during interaction. default = YES
//长按是否自动加减
//若设置为YES,则长按值会一直改变,若设置为NO,则一次点击只会改变一次值
  @property(nonatomic) BOOL autorepeat;                     // if YES, press & hold repeatedly alters value. default = YES

//设置控制器的值是否循环(到达边界后,重头开始,默认为NO)
  @property(nonatomic) BOOL wraps;                          // if YES, value wraps from min <-> max. default = NO

  @property(nonatomic) double value;                        // default is 0. sends UIControlEventValueChanged. clamped to min/max
  @property(nonatomic) double minimumValue;                 // default 0. must be less than maximumValue
  @property(nonatomic) double maximumValue;                 // default 100. must be greater than minimumValue
//设置控制器的步长
  @property(nonatomic) double stepValue;                    // default 1. must be greater than 0
//
//// The tintColor is inherited through the superview hierarchy. See UIView for more information.
  @property(null_resettable,nonatomic,strong) UIColor *tintColor NS_AVAILABLE_IOS(6_0);
//
//// a background image which will be 3-way stretched over the whole of the control. Each half of the stepper will paint the image appropriate for its state
  - (void)setBackgroundImage:(nullable UIImage*)image forState:(UIControlState)state NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR;
  - (nullable UIImage*)backgroundImageForState:(UIControlState)state NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR;
//
//// an image which will be painted in between the two stepper segments. The image is selected depending both segments‘ state
//通过左右按钮的状态设置分割线的图片
  - (void)setDividerImage:(nullable UIImage*)image forLeftSegmentState:(UIControlState)leftState rightSegmentState:(UIControlState)rightState NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR;
  - (nullable UIImage*)dividerImageForLeftSegmentState:(UIControlState)state rightSegmentState:(UIControlState)state NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR;
//
//// the glyph image for the plus/increase button
//设置和获取加号按钮的图片
  - (void)setIncrementImage:(nullable UIImage *)image forState:(UIControlState)state NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR;
  - (nullable UIImage *)incrementImageForState:(UIControlState)state NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR;
//
//// the glyph image for the minus/decrease button
//设置和获取减号按钮的图片
  - (void)setDecrementImage:(nullable UIImage *)image forState:(UIControlState)state NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR;
  - (nullable UIImage *)decrementImageForState:(UIControlState)state NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR;
//

 

第五篇 - UIStepper

标签:

原文地址:http://www.cnblogs.com/kinghx/p/5286715.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!