UISteeper 步进器方法的简单整理

//初始化

  self.step=[[UIStepper alloc]initWithFrame:CGRectMake(80, 80, 10, 10)];
   
   
赋值
 
   self.step.value=2;
   
   
//    //    //minimumValue设定最小值
   
//    //    self.step.minimumValue=0 ;
   
   
//    //    //maximumValue设定最大值
   
//    //    self.step.maximumValue=20;
   
   
//    //    //stepValue设定步进数
   
//    //    self.step.stepValue=2;
   
   
//    //wraps是否重复循环
   
//    //self.step.wraps=YES;
   
   
//    //autorepeat是否自动循环,一般默认为yes
   
//    //self.step.autorepeat=YES;


   
//    //continuous是否连续进行
   
//    //self.step.continuous=NO;
   
//
   
//setBackgroundImage添加背景图片
[self.step setBackgroundImage:[UIImage imageNamed:@"blood.png"]                forState:UIControlStateNormal];       

   
////    setIncrementImage添加加号按钮图片
  
[self.step setIncrementImage:[UIImage imageNamed:@"0.png"] forState:UIControlStateNormal];
   
   
//setDecrementImage添加减号的图片
 [self.step setDecrementImage:[UIImage imageNamed:@"blood"] forState:UIControlStateNormal];

//获取减号背景图片;
   [self.step decrementImageForState:UIControlStateNormal];
   
    
   
//setDividerImage添加分割线图片
   
[self.step setDividerImage:[UIImage imageNamed:@"blood"] forLeftSegmentState:UIControlStateNormal
            
//rightSegmentState:UIControlStateNormal];
   
   
//dividerImageForLeftSegmentState 获取分割线的图片
    [self.step dividerImageForLeftSegmentState:UIControlStateHighlighted rightSegmentState:UIControlStateSelected];
   
   
//incrementImageForState获取加号图片
   
//[self.step incrementImageForState:UIControlStateReserved];
   
   
//获取背景图片 backgroundImageForState
//    //[self.step backgroundImageForState:UIControlStateHighlighted];
 
   
   

   
   
[self.step addTarget:self action:@selector(changvalue) forControlEvents:UIControlEventValueChanged];
       [
self.view addSubview:self.step];
}

-(
void)changvalue{
   
NSLog(@"%.0f",self.step.value);
   

}


转载于:https://my.oschina.net/u/2602001/blog/596161

你可能感兴趣的:(UISteeper 步进器方法的简单整理)