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
时间: 2024-08-03 02:57:16

UI4_UIStepper与UIProgressView的相关文章

【学习ios之路:UI系列】UIProgressView

实现类似读取数据进度条效果 代码如下: ①创建UIProgressView对象 1)定义属性 { NSTimer *_proTimer;//计时 } @property (nonatomic, retain) UIProgressView *proView; //显示进度信息 @property (nonatomic, retain) UILabel *proLabel; @property (nonatomic, assign) float proValue;//保存进度值 //创建控件UIP

UIProgressView 和 UISlider

UIProgressView 属性: 1.progress 当前进度值 2.progressTintColor 高亮颜色 3.trackTinkColor 轨道颜色 4.progressImage 进度条图片 5.trackImage 轨道图片 方法: //设置进度 - (void)setProgress:(float)progress animated:(BOOL)animated UISlider 属性: 1.value 当前值 2.minimumValue 最小值 3.maximumVal

IOS基础-UIProgressView

UIProgressView和UIActivityIndicator有些类似 但是不同之处在于, UIProgressView能够更加精确的反应进度 UIActivityIndicator则只能表示事物在进行中 有一个例子是在Mail程序中当在下载信息的时候,有一个UIProgressView显示在底部 - (void)viewDidLoad {     [super viewDidLoad];          //定义一个进度条     UIProgressView *progressV =

UIActivityIndicatorView、UIProgressView 活动与进度指示器-iOS开发

活动指示器(UIActivityIndicatorView)可以告知用户有一个操作正在进行中.进度指示器(UIProgressView )也具有同样功能,而且还可以告知用户离操作结束还多远. 这两个指示器都是派生自UIView,所以他们是视图,也可以附着在视图上. 一.UIActivityIndicatorView 活动指示器 1.创建 UIActivityIndicatorView* activityIndicatorView = [ [ UIActivityIndicatorView  al

iOS开发——UI篇Swift篇&UIProgressView

UIProgressView 1 override func viewDidLoad() { 2 super.viewDidLoad() 3 4 titleLabel.text = titleString 5 6 7 // Do any additional setup after loading the view. 8 9 //创建进度控制器 10 var progressView:UIProgressView = UIProgressView(frame: CGRectMake(20, 10

iOS自定义进度条高度(UIProgressView进度条高度改变的实现)

今天自定义了iOS中的进度条,发现系统的进度条高度无法改变, 现在自己封装了一种进度条(实际是是UIView而不是UIProgressView),可以改变进度条的高度,非常好用,分享给大家,直接上代码: //  CTWBProgress.h //  Created by WBapple on 16/7/31. //  Copyright © 2016年 王彬. All rights reserved. // #import <UIKit/UIKit.h> @interface CTWBProg

UIProgressView

UIProgressView顾名思义用来显示进度的,如音乐,视频的播放进度,和文件的上传下载进度等. 下面以一个简单的实例来介绍UIprogressView的使用. @interface ActivityViewController : UIViewController { UIProgressView *proView; double proValue; NSTimer *timer; } @property(nonatomic, retain)  UIProgressView *proVie

【iOS开发-10】UIProgressView进度条的几个属性介绍

进度条目前看来不如滑动控件(slider)实用,至少滑动控件可以让用户动,并且我们还能获得滑动控件的值. 目前还未体会到进度条的魅力. - (void)viewDidLoad { //实例化一个进度条,有两种样式,一种是UIProgressViewStyleBar一种是UIProgressViewStyleDefault,几乎无区别 UIProgressView *pro1=[[UIProgressView alloc]initWithProgressViewStyle:UIProgressVi

UI中一些不常用的控件UIActivityIndicatorView、UIProgressView、UISegmentedControl、UIStepper、UISwitch、UITextView、UIAlertController

1 //UIActivityIndicatorView //小菊花,加载 2 3 #import "ActivityIndicatorVC.h" 4 5 @interface ActivityIndicatorVC (){ 6 UIActivityIndicatorView *_activity ; 7 } 8 9 @end 10 11 @implementation ActivityIndicatorVC 12 13 -(void)viewDidLoad{ 14 [super vie