• 【代码笔记】iOS-正在加载


    一,效果图。

    二,代码。

    复制代码
    - (void)viewDidLoad
    {
        [super viewDidLoad];
        // Do any additional setup after loading the view.
        
        
        [self showFooter:YES];
    }
    -(void)showFooter:(BOOL)showFooter
    {
        NSLog(@"上拉刷新:加载更多view");
        
        if(!loadMoreView)
        {
            loadMoreView=[[UIView alloc]init];
            
            //加载控件
            UIActivityIndicatorView *activeView=[[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
            
            [activeView setFrame:CGRectMake(110, 10, 30, 30)];
            [activeView setBackgroundColor:[UIColor clearColor]];
            [loadMoreView addSubview:activeView];
            [activeView startAnimating];
       
            
            //文本
            UILabel *loadLabel=[[UILabel alloc]initWithFrame:CGRectMake(140, 10, 150, 30)];
            [loadLabel setTextAlignment:NSTextAlignmentLeft];
            [loadLabel setText:@"正在加载"];
            [loadLabel setTextColor:[UIColor colorWithRed:150/255.00 green:150/255.00 blue:150/255.00 alpha:1.0]];
            [loadLabel setBackgroundColor:[UIColor clearColor]];
            [loadMoreView addSubview:loadLabel];
        }
        
        [loadMoreView setFrame:CGRectMake(0, 60, 320, 100)];
        [loadMoreView setBackgroundColor:[UIColor clearColor]];
        
        if(!loadMoreView.superview)
        {
            [self.view addSubview:loadMoreView];
        }
        if(showFooter)
        {
           [loadMoreView setAlpha:1];
        }
        else
        {
           [loadMoreView setAlpha:0];
        }
        
    }
  • 相关阅读:
    汇编 gdb调试
    汇编 运行错误解决办法
    binutils安装
    汇编错误
    汇编
    pthread_create()
    error2019-01-17 宏STDOUT_FILENO
    2019-01-17 跳至首行
    .NET MVC 两种视图引擎(Razor、Aspx)
    ECharts属性设置
  • 原文地址:https://www.cnblogs.com/yang-guang-girl/p/5690463.html
Copyright © 2020-2023  润新知