zoukankan      html  css  js  c++  java
  • UI4_UIStepper与UIProgressView

    //
    //  ViewController.m
    //  UI4_UIStepper与UIProgressView
    //
    //  Created by zhangxueming on 15/7/7.
    //  Copyright (c) 2015年 zhangxueming. All rights reserved.
    //
    
    #import "ViewController.h"
    
    @interface ViewController ()
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
        [super viewDidLoad];
        // Do any additional setup after loading the view, typically from a nib.
        //步进器(94*29)
        UIStepper *step = [[UIStepper alloc] initWithFrame:CGRectMake(100, 200, 0, 0)];
        NSLog(@"step = %@", step);
        
        //设置步进器的连续性
        step.continuous = YES;
        
        //设置步长
        step.stepValue = 0.01;
        //设置最小值
        step.minimumValue  = 0;
        //设置最大值
        step.maximumValue  = 1;
        //
        step.tintColor = [UIColor redColor];
        //
        [step setBackgroundImage:[UIImage imageNamed:@"truckmin"] forState:UIControlStateNormal];
        //添加点击事件
        [step addTarget:self action:@selector(stepValueChange:) forControlEvents:UIControlEventValueChanged];
        [self.view addSubview:step];
        
        //进度条
        UIProgressView *progress = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault];
        progress.frame = CGRectMake(10, 400, self.view.frame.size.width-20, 10);
        progress.tintColor = [UIColor cyanColor];
        progress.trackTintColor = [UIColor redColor];
        //进度
        progress.progress = 0.0;
        progress.tag = 100;
        [self.view addSubview:progress];
        
    }
    
    - (void)stepValueChange:(UIStepper *)step
    {
        NSLog(@"%.2f", step.value);
        UIProgressView *progressView = (UIProgressView *)[self.view viewWithTag:100];
        progressView.progress = step.value;
        
    }
    
    
    - (void)didReceiveMemoryWarning {
        [super didReceiveMemoryWarning];
        // Dispose of any resources that can be recreated.
    }
    
    @end
    
  • 相关阅读:
    随便写的,关于外部提交按钮
    thinkPHP--empey标签
    ramdajs库应用场景
    数组常用用法--map,filter,reduce
    接口签名
    四种常见的 POST 提交数据方式
    localhost、127.0.0.1和0.0.0.0和本机IP的区别
    ftp与sftp
    本地已有项目上传git
    github和gitlab比较
  • 原文地址:https://www.cnblogs.com/0515offer/p/4638795.html
Copyright © 2011-2022 走看看