zoukankan      html  css  js  c++  java
  • UIActivityIndicatorView 的使用

    //
    //  UIActivityIndicator.m
    //  ToolBar
    //
    //  Created by lanouhn on 15/1/3.
    //  Copyright (c) 2015 niutiantian. All rights reserved.
    //

    #import "UIActivityIndicator.h"

    @interface UIActivityIndicator ()
    {
        UIActivityIndicatorView *activityView;
    }
    @end

    @implementation UIActivityIndicator

    - (void)viewDidLoad {
        [super viewDidLoad];
        // Do any additional setup after loading the view.
    //    UIActivityIndicatorView: 风火轮视图,作用是提醒用户正在加载数据
        
            //风火轮的样式
    //    UIActivityIndicatorViewStyleWhiteLarge大型白色指示器
    //    UIActivityIndicatorViewStyleWhite标准尺寸白色只指示器
    //    UIActivityIndicatorViewStyleGray灰色指示器,用于白色背景

        activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
        activityView.frame = CGRectMake(0, 0, 40, 40);
        activityView.center = self.view.center;
            //设置颜色
        activityView.color = [UIColor redColor];
        
            //指示器停止后自动隐藏
        activityView.hidesWhenStopped = YES;
        
        [self.view addSubview:activityView];
        [activityView release];
        
        UIButton *starButton = [UIButton buttonWithType:UIButtonTypeSystem];
        starButton.frame = CGRectMake(100, 100, 40, 40);
        [starButton setTitle:@"开始" forState:UIControlStateNormal];
        
        [starButton addTarget:self action:@selector(starAnimation) forControlEvents:UIControlEventTouchUpInside];
        
        
        [self.view addSubview:starButton];
        
        UIButton *stopButton = [UIButton buttonWithType:UIButtonTypeSystem];     stopButton.frame = CGRectMake(100, 160, 40, 40);     [stopButton setTitle:@"停止" forState:UIControlStateNormal];     [stopButton addTarget:self action:@selector(stopAnimation) forControlEvents:UIControlEventTouchUpInside];     [self.view addSubview:stopButton];      } - (void)starAnimation {     [activityView startAnimating];//开启动画 } - (void)stopAnimation {     [activityView stopAnimating];//关闭动画 } @end

     
  • 相关阅读:
    yii 验证码功能的实现
    关于php优化 你必须知道的一些事情
    php实现两分法查找
    Python封装的访问MySQL数据库的类及DEMO
    新学习的Python的代码(while循环)
    基于位运算符的IP和数值转换
    JS数组操作常用方法
    JS输出日历
    PHP程序输出日历
    PHP中计算时间差(上周,上月,去年,昨天等)
  • 原文地址:https://www.cnblogs.com/tian-sun/p/4201373.html
Copyright © 2011-2022 走看看