zoukankan      html  css  js  c++  java
  • iOS学习-其他常用控件2

     1 //
     2 //  ViewController.m
     3 //  其他常用控件2
     4 //
     5 //  Created by 大欢 on 16/1/25.
     6 //  Copyright © 2016年 bjsxt. All rights reserved.
     7 //
     8 
     9 #import "ViewController.h"
    10 
    11 @interface ViewController ()
    12 
    13 @property (nonatomic, strong) UIActivityIndicatorView * indicatorView;
    14 
    15 @property (weak, nonatomic) IBOutlet UILabel *stepperLabel;
    16 - (IBAction)startActity:(id)sender;
    17 - (IBAction)stopActity:(id)sender;
    18 
    19 
    20 @end
    21 
    22 @implementation ViewController
    23 
    24 - (void)viewDidLoad {
    25     [super viewDidLoad];
    26 //    [self createStepper];
    27     
    28     self.view.backgroundColor = [UIColor orangeColor];
    29     
    30     UIActivityIndicatorView * indicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
    31     
    32     //暂停时隐藏
    33     indicatorView.hidesWhenStopped = YES;
    34     
    35     indicatorView.center = self.view.center;
    36     
    37     //设置风火轮的颜色
    38     indicatorView.color = [UIColor redColor];
    39     
    40     [self.view addSubview:indicatorView];
    41     
    42     self.indicatorView = indicatorView;
    43     
    44 }
    45 
    46 - (void)createStepper {
    47     
    48     //计数器控件
    49     UIStepper * stepper = [[UIStepper alloc] initWithFrame:CGRectMake(100, 100, 0, 0)];
    50     [self.view addSubview:stepper];
    51     
    52     stepper.value = 30;
    53     stepper.minimumValue = 10;
    54     stepper.maximumValue = 50;
    55     stepper.stepValue = 2;
    56     stepper.continuous = NO;
    57     //临界是否继续输出,min <-> max
    58     stepper.wraps = YES;
    59     stepper.tintColor = [UIColor redColor];
    60     //点住按钮是否自动增加计数
    61     stepper.autorepeat = YES;
    62     
    63     [stepper addTarget:self action:@selector(stepAction:) forControlEvents:UIControlEventValueChanged];
    64 }
    65 
    66 - (void)stepAction:(UIStepper *)stepper {
    67     
    68     NSLog(@"%lf",stepper.value);
    69     self.stepperLabel.font = [UIFont systemFontOfSize:stepper.value];
    70     
    71 }
    72 
    73 
    74 
    75 - (IBAction)startActity:(id)sender {
    76     
    77     [self.indicatorView startAnimating];
    78 }
    79 
    80 - (IBAction)stopActity:(id)sender {
    81     
    82     [self.indicatorView stopAnimating];
    83 }
    84 @end
  • 相关阅读:
    【根据条件添加属性】vue页面标签根据条件添加属性
    serialVersionUID
    onsubmit="return navTabSearch(this);"
    MyEclipse改变项目的编码方式
    Tomcat端口被占用
    可拖动图层
    顶部可以折叠的菜单工具栏
    转---- javascript prototype介绍的文章
    网页右侧弹出有缓冲效果的工具栏
    根据时间改变背景
  • 原文地址:https://www.cnblogs.com/MrWuYindi/p/5158897.html
Copyright © 2011-2022 走看看