美文网首页
小菊花加载View-UIActivityIndicatorVie

小菊花加载View-UIActivityIndicatorVie

作者: 怪兽密保 | 来源:发表于2017-09-20 14:54 被阅读0次
    实现代码
    self.activityIndicatorView=[[UIActivityIndicatorView alloc]initWithFrame:CGRectMake(0, 0, 100, 100)];
        self.activityIndicatorView.center=self.view.center;
    //设置样式
        [self.activityIndicatorView setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleGray];
        [self.activityIndicatorView setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleWhiteLarge];
        [self.activityIndicatorView setBackgroundColor:[UIColor lightGrayColor]];
        [self.view addSubview:self.activityIndicatorView];
    //开始动画
        [self.activityIndicatorView startAnimating];
    

    关于style的设置,有三种白色和灰色,这两种的尺寸都是20*20,白色大图是37*37:

    typedef NS_ENUM(NSInteger, UIActivityIndicatorViewStyle) {
        UIActivityIndicatorViewStyleWhiteLarge,
        UIActivityIndicatorViewStyleWhite,
        UIActivityIndicatorViewStyleGray,
    };
    
    关闭动画
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5* NSEC_PER_SEC)), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),^{
            [self.activityIndicatorView stopAnimating];
        });
    

    相关文章

      网友评论

          本文标题:小菊花加载View-UIActivityIndicatorVie

          本文链接:https://www.haomeiwen.com/subject/zydlpttx.html