zoukankan      html  css  js  c++  java
  • 自定义选择动画提示

    #pragma mark - 创建旋转动画提示
    - (CustomView *)initIndicatorViewWithTitle:(NSString *)title
    {
        self = [super initWithFrame:[[UIScreen mainScreen] bounds]];
        if (self) {
            
            //创建背景视图
            UIView *bgView = [[UIView alloc]initWithFrame:[[UIScreen mainScreen] bounds]];
            bgView.alpha = 0.1;//显示此视图时,不可进行其他操作
            bgView.backgroundColor = [UIColor grayColor];
            [self addSubview:bgView];
            
            //创建活动指示器
            UIActivityIndicatorView *indicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
            
            CGFloat x = kScreenW / 2 - 50;
            CGFloat y = kScreenH / 2 - 20;
            CGFloat w = 100;
            CGFloat h = 40;
            indicatorView.alpha = 0.5;
            indicatorView.frame = CGRectMake(x, y, w, h);
            
            //设置活动指示器的圆角
            indicatorView.layer.cornerRadius = 4;
            indicatorView.layer.masksToBounds = YES;
            
            //设置活动指示器在自身视图中的位置
            indicatorView.bounds = CGRectMake(25, kZero, 90, h);
            indicatorView.backgroundColor = [UIColor blackColor];
            [indicatorView startAnimating];
            [self addSubview:indicatorView];
            
            //创建显示的文本
            UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(155, y, w, h)];
            label.font = [UIFont systemFontOfSize:14];
            label.textColor = [UIColor whiteColor];
            label.backgroundColor = [UIColor clearColor];
            [self addSubview:label];
            
            if ([title isEqualToString:@""] || title == nil) {
                label.text = @"加载中";
            }else{
                label.text = title;
            }
        }
        return self;
    }
    //类方法 + (CustomView *)initIndicatorViewWithTitle:(NSString *)title { return [[self alloc]initIndicatorViewWithTitle:title]; }
  • 相关阅读:
    编写 ES6 的 7 个实用技巧
    [docker] 常用命令
    ansible 的第一次亲密接触
    [bug] JS sort 函数在 ios 中无效
    这几天bug多,自我检讨一下
    【面试】——随手收集面试问题
    Linux的五个查找命令:find,locate,whereis,which,type
    Linux下php安装Redis扩展
    mysql in 子查询 效率慢 优化(转)
    mysql group by 用法解析(详细)
  • 原文地址:https://www.cnblogs.com/hw140430/p/3970380.html
Copyright © 2011-2022 走看看