zoukankan      html  css  js  c++  java
  • UIStepper

     

    UIStepper

    分类: IOS
    - (void)viewDidLoad
    {
        [super viewDidLoad];
        // Do any additional setup after loading the view, typically from a nib.
        
        UIStepper *stepper = [[UIStepper alloc] init];
        stepper.tag = 10;
        stepper.center = CGPointMake(160, 240);
        stepper.minimumValue = 1; //设置最小值
        stepper.maximumValue = 30; //设置最大值
        stepper.stepValue = 2; //每次递增2
        stepper.value = 15; //初始值
        [stepper setWraps:YES]; //是否循环
        [stepper addTarget:self action:@selector(doTest) forControlEvents:UIControlEventValueChanged];
        
        
        [self.view addSubview:stepper];
        [stepper release];

    }

    -(void)doTest
    {
        UIStepper *per = (UIStepper*)[self.view viewWithTag:10];
        
        if (per.continuous)
        {
            NSLog(@"Y");
            int a = per.value;  //获取当前值
            NSLog(@"%d", a);
        }
        else 
        {
            NSLog(@"N");
        }
    }
  • 相关阅读:
    Python基础知识2-内置数据结构(上)
    vs code的快捷方式
    vs code配置
    vs code安装
    web浏览器兼容问题
    js正則表達式
    MVC MVP MVVM
    vue-cli(vue脚手架)
    web攻擊
    web前端面試題
  • 原文地址:https://www.cnblogs.com/iOS-mt/p/4143682.html
Copyright © 2011-2022 走看看