菊花轉(zhuǎn)的封裝

一 聲明方法

#import@interface MyLodingView : UIView

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

@end

二? 實現(xiàn)方法


#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];

}

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 1、設(shè)置UILabel行間距 NSMutableAttributedString* attrString = [[...
    十年一品溫如言1008閱讀 2,030評論 0 3
  • *7月8日上午 N:Block :跟一個函數(shù)塊差不多,會對里面所有的內(nèi)容的引用計數(shù)+1,想要解決就用__block...
    炙冰閱讀 2,728評論 1 14
  • 1、禁止手機睡眠[UIApplication sharedApplication].idleTimerDisabl...
    DingGa閱讀 1,206評論 1 6
  • 文/雒宏軍 縣城里常有店鋪開張與關(guān)門,這是經(jīng)濟規(guī)律,誰也阻擋不了。長盛不衰的的卻是“某某輔導(dǎo)中心”或者“某某英語學(xué)...
    雒宏軍的菜園子閱讀 275評論 2 3
  • 我乃六零后,而今近五旬。生在木瓦房,用的老火桌。吃的是娘奶,牛奶沒見過。稻草作床墊,兄弟同被窩。衛(wèi)生不太好,常有跳...
    新化龍山居士閱讀 373評論 1 0

友情鏈接更多精彩內(nèi)容