• 2016-01-07 activityviewcontroller


    //

    //  activityViewController.m

    //  toolbar

    //

    //  Created by Apple on 16/1/7.

    //  Copyright © 2016 ShangYu. All rights reserved.

    //

     

    #import "activityViewController.h"

     

    @interface activityViewController ()

    @property (strong, nonatomic) UIActivityIndicatorView *activityIndicator ;

    @property (nonatomic, strong) NSTimer *timer;//定时器 图片轮播

     

     

    @end

     

    @implementation activityViewController

     

    - (void)viewDidLoad {

        [super viewDidLoad];

        self.view.backgroundColor=[UIColor whiteColor];

    //    使用方式就是

    //    UIActivityIndicatorView *testActivityIndicator = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];

    //    testActivityIndicator.center = CGPointMake(100.0f, 100.0f);//只能设置中心,不能设置大小

    //    testActivityIndicator.frame= CGRectMake(100, 100, 100, 100);//不建议这样设置,因为UIActivityIndicatorView是不能改变大小只能改变位置,这样设置得到的结果是控件的中心在(100100)上,而不是和其他控件的frame一样左上角在(100 100)长为100,宽为100.

    //    [self.navigationController.navigationItem addSubview:testActivityIndicator];

    //    testActivityIndicator.color = [UIColor redColor]; // 改变圈圈的颜色为红色; iOS5引入

    //    [testActivityIndicator startAnimating]; // 开始旋转

    //    [testActivityIndicator stopAnimating]; // 结束旋转

    //    [testActivityIndicator setHidesWhenStopped:YES]; //当旋转结束时隐藏

        

        

        [self avctiy];

     

     

     

    }

     

     

    -(void)avctiy{

     

        self.activityIndicator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(100, 100, 60, 60)];

        

        [self.view addSubview:self.activityIndicator];

        self.activityIndicator.backgroundColor=[UIColor redColor];

        

        self.activityIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray;

        

        [self.activityIndicator startAnimating];

        [self addTimer];

        

    //    

    //    [NSTimer scheduledTimerWithTimeInterval:3.0f target:self selector:@selector(timerStop) userInfo:nil repeats:YES];

     

     

     

    }

     

    - (void)timerStop

     

    {

        [self.activityIndicator stopAnimating];

    }

     

     

     

    - (void)addTimer{

        [self.activityIndicator startAnimating];

     

        self.timer = [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(Timer) userInfo:nil repeats:YES];

     

    }

    /**

     *  关闭定时器

     */

    - (void)removeTimer

    {

        [self.timer invalidate];

    }

     

     

     

    -(void)Timer{

        [self.activityIndicator stopAnimating];

        }

     

     

    @end

  • 相关阅读:
    HDU 5302(Connect the Graph- 构造)
    Redis 集群
    HDFS集中式缓存管理(Centralized Cache Management)
    JavaScript语言基础12
    【IOS】启动画面
    小贝_mysql优化学习
    hdu2099 整除的位数(暴力)
    Receiver type ‘X’ for instance message is a forward declaration
    动态游标(比如表名作为參数)以及动态SQL分析
    mongodb与SQL相应关系表
  • 原文地址:https://www.cnblogs.com/gzz2016/p/5110693.html
Copyright © 2020-2023  润新知