• 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);
    }

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

  • 相关阅读:
    Angular
    Angular
    Angular
    Angular
    Angular
    Angular
    Angular
    springsecurity 源码解读 之 RememberMeAuthenticationFilter
    springsecurity 源码解读之 AnonymousAuthenticationFilter
    springsecurity 源码解读之 SecurityContext
  • 原文地址:https://www.cnblogs.com/laolitou-ping/p/6244152.html
Copyright © 2020-2023  润新知