星空网 > 软件开发 > 操作系统

UIStepper

//初始化stpper,大小是固定的
    UIStepper *step=[[UIStepper alloc]initWithFrame:CGRectMake(100, 100, 0, 0)];
    //设置最小值最大值
    step.minimumValue=1;
    step.maximumValue=30;
    //设置每次增加的值
    step.stepValue=1;
    //设置允许循环
    [step setWraps:YES];
    //设置初始值
    step.value=2;
    //添加点击事件,让数值显示在界面label中
    [step addTarget:self action:@selector(putValueOut:) forControlEvents:UIControlEventValueChanged];
    [self.view addSubview:step];

 

 

//点击事件
-(void)putValueOut:(UIStepper *)stepper
{
    int a=stepper.value;
    _label.text=[NSString stringWithFormat:@"%d",a];
}

 



原标题:UIStepper

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流