菊花转的封装

一 声明方法

#import@interface MyLodingView : UIView

+ (void)showLoadingWithAfterDelay:(NSTimeInterval)second superView:(UIView *)superView;

@end

二  实现方法


#import "MyLodingView.h"

#define KScreenWidth [[UIScreen mainScreen]bounds].size.width

#define KScreenHeight [[UIScreen mainScreen]bounds].size.height

#define COLOR(R, G, B, A) [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:A]

@implementation MyLodingView

+ (void)showLoadingWithAfterDelay:(NSTimeInterval)second superView:(UIView *)superView

{

MyLodingView *myLodingView = [[MyLodingView alloc] initWithFrame:CGRectMake(KScreenWidth / 2 - 50 , KScreenHeight / 2 - 50, 100, 100)];

UIActivityIndicatorView *juhua = [[UIActivityIndicatorView alloc]initWithFrame:CGRectMake(0 , 0, 100, 100)];

juhua.backgroundColor = COLOR(81, 191, 156, 1);

juhua.layer.cornerRadius = 10;

juhua.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;

[juhua startAnimating];

UILabel *label =[[UILabel alloc]initWithFrame:CGRectMake(10, 70, 80,40)];

label.text = @"loading...";

label.font = [UIFont systemFontOfSize:13];

label.textColor = [UIColor whiteColor];

[juhua addSubview:label];

[myLodingView addSubview:juhua];

[superView addSubview:myLodingView];

[myLodingView performSelector:@selector(hideLoading:) withObject:juhua afterDelay:second];

}

// 自动消失菊花

- (void)hideLoading:(UIActivityIndicatorView *)juhua

{

[juhua stopAnimating];

[juhua removeFromSuperview];

}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 1、设置UILabel行间距 NSMutableAttributedString* attrString = [[...
    十年一品温如言1008阅读 1,693评论 0 3
  • *7月8日上午 N:Block :跟一个函数块差不多,会对里面所有的内容的引用计数+1,想要解决就用__block...
    炙冰阅读 2,531评论 1 14
  • 1、禁止手机睡眠[UIApplication sharedApplication].idleTimerDisabl...
    DingGa阅读 1,141评论 1 6
  • 文/雒宏军 县城里常有店铺开张与关门,这是经济规律,谁也阻挡不了。长盛不衰的的却是“某某辅导中心”或者“某某英语学...
    雒宏军的菜园子阅读 238评论 2 3
  • 我乃六零后,而今近五旬。生在木瓦房,用的老火桌。吃的是娘奶,牛奶没见过。稻草作床垫,兄弟同被窝。卫生不太好,常有跳...
    新化龙山居士阅读 342评论 1 0