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

     
  • 相关阅读:
    【IHttpHandler】在ASP.Net2.0中使用UrlRewritingNet实现链接重写
    【IHttpHandler】IHttpModule实现URL重写
    【IHttpHandler】使用IHttpHandler防盗链
    【IHttpHandler】HttpModule,HttpHandler,HttpHandlerFactory简单使用
    【IHttpHandler】HttpModule的认识
    【IHttpHandler】了解 IHttpHandler
    【MVC】ASP.NET MVC 请求生命周期
    【MVC】ASP.NET MVC HtmlHelper用法大全
    【MVC】ASP.NET MVC中实现多个按钮提交的几种方法
    【MVC】自定义ASP.NET MVC Html辅助方法
  • 原文地址:https://www.cnblogs.com/tian-sun/p/4201373.html
Copyright © 2011-2022 走看看