首页 > 代码库 > 自定义选择动画提示
自定义选择动画提示
#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];}
自定义选择动画提示
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。