LoadingView
//
// LoadingView.h
// 蓝桥播报
//
// Created by 小小建 on 15/7/10.
// Copyright (c) 2015年 蓝桥. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface LoadingView : NSObject
{
UIView *_backGroundView;
UIView *_centerLoadingView;
UIActivityIndicatorView *_activityView;
}
+(LoadingView *)shareLoadingView;
-(void)show;
-(void)hide;
@end
//
// LoadingView.m
// 蓝桥播报
//
// Created by 小小建 on 15/7/10.
// Copyright (c) 2015年 蓝桥. All rights reserved.
//
#import "LoadingView.h"
#import "AppDelegate.h"
static LoadingView *singleInstance=nil;
@implementation LoadingView
+(LoadingView *)shareLoadingView{
@synchronized(self){
if (singleInstance==nil) {
singleInstance=[[self alloc] init];
}
}
return singleInstance;
}
-(void)show{
AppDelegate *delegate=(AppDelegate *)[UIApplication sharedApplication].delegate;
_backGroundView=[[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds];
[_backGroundView setBackgroundColor:[UIColor blackColor]];
_backGroundView.alpha=0.6;
[delegate.window addSubview:_backGroundView];
_centerLoadingView=[[UIView alloc] initWithFrame:CGRectMake(0, 0, 150, 150)];
_centerLoadingView.center=CGPointMake([UIScreen mainScreen].bounds.size.width/2, [UIScreen mainScreen].bounds.size.height/2);
UIImageView *imgView=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 150, 150)];
[imgView setImage:[UIImage imageNamed:@"loading_bg.png"]];
_activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
_activityView.center = CGPointMake(imgView.frame.size.width/2, imgView.frame.size.height/2-20);
_activityView.hidesWhenStopped = YES;
[_activityView startAnimating];
[imgView addSubview:_activityView];
UILabel *labelInfo = [[UILabel alloc] initWithFrame:CGRectMake(0,0, 140, 60)];
labelInfo.center=CGPointMake(imgView.frame.size.width/2, imgView.frame.size.height/2+20);
labelInfo.numberOfLines = 2;
labelInfo.backgroundColor = [UIColor clearColor];
labelInfo.textAlignment = NSTextAlignmentCenter;
labelInfo.textColor = [UIColor whiteColor];
labelInfo.font = [UIFont systemFontOfSize:16];
labelInfo.text=@"加载中...";
[imgView addSubview:labelInfo];
[_centerLoadingView addSubview:imgView];
[delegate.window addSubview:_centerLoadingView];
}
-(void)hide{
[_activityView stopAnimating];
[_centerLoadingView removeFromSuperview];
[_backGroundView removeFromSuperview];
}
@end
LoadingView的更多相关文章
- Android showing LoadingView or EmptyView for Activity or Fragment
这几天利用一些时间,整理了一下,写了一个简单的工具类,用来快速的显示LoadingView或者EmptyView,以前都是定义一个layout,根布局为FrameLayout,再在layout布局文件 ...
- LoadingView 自定义加载图片
#import <UIKit/UIKit.h> @interface LoadingView : UIView @property (nonatomic,strong) NSMutable ...
- Android 自定义通用的loadingview
介绍 好久没有写博客啦,最近在接近新年了,年前的工作都要收尾,所以特别忙,周末抽空写了个通用的加载view,写篇博客分享出来. 功能 1.显示加载视图,加载失败的时候显示加载失败视图,数据为空时显示数 ...
- (Android自定义View)来来来,一起再撸一个Material风格loadingView。
本文同步自博主的个人博客wing的地方酒馆 很久很久以前,撸了一款loadingview(点击这里回顾),当时觉得还不错,现在看看觉得好丑啊!!! 于是想再撸一个,无意间在这里看到一个很不错的效果,于 ...
- 手把手教你画一个 逼格满满圆形水波纹loadingview Android
才没有完结呢o( ̄︶ ̄)n .大家好,这里是番外篇. 拜读了爱哥的博客,又学到不少东西.爱哥曾经说过: 要站在巨人的丁丁上. 那么今天,我们就站在爱哥的丁丁上来学习制作一款自定义view(开个玩笑,爱 ...
- 自定义控件---loadingView
自定义加载框,效果如图: 这个loadingView可以在图片下添加文案(加载中...),还可以自定义动画效果,自定义布局文件,屏蔽用户操作,点击返回键后隐藏. 库类中包含了一个LoadingDial ...
- 三角函数之美-水波纹载入LoadingView
一.前言 学习是要总结的.近期几天学习了画图相关的,可是使用的机会较少,如今又快要遗忘了,这次看了水波纹的绘制.认为十分有意思,还是 把实现的方法记录下来.技术无他,为手熟尔.还是要多练习,空淡误国, ...
- HarmonyOS三方件开发指南(15)-LoadingView功能介绍
目录: 1. LoadingView组件功能介绍2. Lottie使用方法3. Lottie开发实现4.<HarmonyOS三方件开发指南>系列文章合集 1. LoadingView组件功 ...
- iOS开发系列--Swift进阶
概述 上一篇文章<iOS开发系列--Swift语言>中对Swift的语法特点以及它和C.ObjC等其他语言的用法区别进行了介绍.当然,这只是Swift的入门基础,但是仅仅了解这些对于使用S ...
随机推荐
- 用.net 发送邮件
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.N ...
- 给hadoop新手的一封信:Hadoop入门自学及对就业的帮助
学习指南,刚接触这个确实有点懵逼,感觉还有很多东西要学要看,自己要逐渐构造成一个框架的体系. 附上一个学习博客地址: http://www.cnblogs.com/mephisto/p/4835386 ...
- mongodb 启动脚本和配置
http://justcoding.iteye.com/blog/2270466 http://blog.csdn.net/neutrojan/article/details/32328531
- Eclipse下配置javaweb项目快速部署到tomcat
用惯了VS,再用Eclipse,完全有一种从自动挡到手动挡的感觉啊. 很多同学在Eclipse下开发web项目,每一次修改代码,看效果的时候都有右键项目->Run as -> Run on ...
- git使用入门
添加文件到git仓库 git add readme.txt git commit -m "write a readme file" 查询工作区状态 git status 查询修改内 ...
- OpenCv遍历图像小结
参考:http://www.cnblogs.com/ronny/p/opencv_road_2.html http://blog.csdn.net/xiaowei_cqu/article/detail ...
- to_char函数
TO_CHAR 是把日期或数字转换为字符串,不能指定字符串长度. 使用TO_CHAR函数处理日期:TO_CHAR(number, '格式') eg:TO_CHAR(salary,'$99,999.99 ...
- Centos 6.5 X64 环境下编译 hadoop 2.6.0 --已验证
Centos 6.5 x64 hadoop 2.6.0 jdk 1.7 protobuf-2.5.0 maven-3.0.5 set environment export JAVA_HOME=/hom ...
- flume使用示例
flume的特点: flume是一个分布式.可靠.和高可用的海量日志采集.聚合和传输的系统.支持在日志系统中定制各类数据发送方,用于收集数据;同时,Flume提供对数据进行简单处理,并写到各种数据接受 ...
- Dos命令查看端口占用及关闭进程
1. 查看端口占用 在windows命令行窗口下执行: netstat -aon|findstr "8080" TCP 127.0.0.1:80 0.0.0.0:0 LISTENI ...