ios-loading a dynamic diagram (GIF)

Source: Internet
Author: User

1 //2 //BowenView.h3 //ios_0302_ drop-down refresh4 //5 //Created by Ma C on 16/3/2.6 //copyright©2016 Blog Technology. All rights reserved.7 //8 9 #import<UIKit/UIKit.h>Ten  One @interfaceBowenview:uiview A  - //to load the loading interface into that interface -+ (void) Showbowenviewfromsuperview: (UIView *) Superview; the //which interface to remove the loading interface from -+ (void) Removebowenviewfromsuperview: (UIView *) Superview; - //to load the loading interface to that interface (specific location) -+ (void) Showbowenviewfromsuperview: (UIView *) Superview OffSetY: (cgfloat) OffSetY; +  - @end +  A  at  -  - // - //bowenview.m - //ios_0302_ drop-down refresh - // in //Created by Ma C on 16/3/2. - //copyright©2016 Blog Technology. All rights reserved. to // +  - #import "BowenView.h" the  * @interfaceBowenview () $ Panax Notoginseng //Dynamic Graphs -@property (nonatomic, strong) Uiimageview *Loadingimgview; the //hint Text +@property (nonatomic, strong) UILabel *lbl; A  the @end +  -  $  $ @implementationBowenview -  -  the-(instancetype) init - {WuyiSelf =[Super init]; the     if(self) { - [self addSubview:self.loadingImgView]; Wu [self addSubview:self.lbl]; -     } About     returnSelf ; $ } -  --(Uiimageview *) Loadingimgview - { A     if(!_loadingimgview) { +_loadingimgview =[[Uiimageview alloc] init]; the_loadingimgview.frame = CGRectMake (0,0, the, the); -_loadingimgview.backgroundcolor =[Uicolor Clearcolor]; $         //Dynamic Graph Properties the_loadingimgview.animationimages =[self getimagearray]; the_loadingimgview.animationduration =2.0; the_loadingimgview.animationrepeatcount =0; the     } -     return_loadingimgview; in } the  the-(UILabel *) LbL About { the     if(!_lbl) { the_LBL =[[UILabel alloc] init]; the_lbl.frame = CGRectMake (0, the, the, -); +_lbl.text =@"Loading ..."; -_lbl.font = [Uifont systemfontofsize: -]; the_lbl.textcolor =[Uicolor Darkgraycolor];Bayi_lbl.textalignment =Nstextalignmentcenter; the     } the     return_lbl; - } - //get an array of pictures the-(Nsarray *) Getimagearray the { theNsmutablearray *imgarray =[Nsmutablearray array]; theNsmutablearray *imgnamearr =[Nsmutablearray array]; -      the      for(intI=1; i< -; i++) { the          theNSString *imgname = [NSString stringWithFormat:@"loading_animate_%02d", I];94 [Imgarray addobject:imgname]; the     } the      the      for(inti =0; I < the; i + +) {98UIImage *image =[UIImage Imagenamed:[imgarray objectatindex:i]; About [Imgnamearr addobject:image]; -     }101     returnImgnamearr;102     103     104 } the 106 //to load the loading interface into that interface107+ (void) Showbowenviewfromsuperview: (UIView *) Superview108 {109[Self Showbowenviewfromsuperview:superview OffSetY:0]; the }111 //which interface to remove the loading interface from the+ (void) Removebowenviewfromsuperview: (UIView *) Superview113 { the     //Find in "All Child view arrays" in parent view the      for(UIView *itemviewinchsuperview.subviews) { the         if([Itemview Iskindofclass:[bowenviewclass]]) {117 [Itemview Removefromsuperview];118         }119     } - }121 //to load the loading interface to that interface (specific location)122+ (void) Showbowenviewfromsuperview: (UIView *) Superview OffSetY: (cgfloat) OffSetY123 {124Bowenview *loadingview =[[Bowenview alloc] init]; theLoadingview.frame = CGRectMake ([UIScreen mainscreen].bounds.size.width/2- +, $+ OffSetY, -, the);126 127     //determine if a bowenview already exists on the Superview, if it already exists, delete it before loading the new view - [self removebowenviewfromsuperview:superview];129 [Superview Addsubview:loadingview]; the     131     //let the dynamic graph move. the [Loadingview.loadingimgview startanimating];133     134     135 }136 137 @end

ios-loading a dynamic diagram (GIF)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.