zoukankan      html  css  js  c++  java
  • UI第九节——UIStepper

    - (void)viewDidLoad {
        [super viewDidLoad];
        
        // 实例化UIStepper,大小是固定的
        UIStepper *stepper = [[UIStepper alloc] initWithFrame:CGRectMake(40, 100, 295, 200)];
        
        // 设置最大值和最小值
        stepper.maximumValue = 1000;
        stepper.minimumValue = 900;
        
        // 设置它的值
        stepper.value = 950;
        
        // 设置每点一下,加减的值
        stepper.stepValue = 10;
        
        // 当到达最大值或最小值时,会循环回来
        stepper.wraps = YES;
        
        // 添加事件
        [stepper addTarget:self action:@selector(stepperValueChanged:) forControlEvents:UIControlEventValueChanged];
        
        // 把Stepper添到self.view上
        [self.view addSubview:stepper];
    }

    - (void)stepperValueChanged:(UIStepper *)stepper
    {
        NSLog(@"%f", stepper.value);
    }

    如果对你有帮助,请关注我哦!

  • 相关阅读:
    3.24
    3.23
    构建之法读书笔记2
    寒假学习day23
    寒假学习day22
    寒假学习day21
    寒假学习day20
    寒假学习day19
    寒假学习每周总结4
    寒假学习day18
  • 原文地址:https://www.cnblogs.com/laolitou-ping/p/6244152.html
Copyright © 2011-2022 走看看