IOS Custom Rotors

Source: Internet
Author: User

Inherit with UIView, call start and stop events directly;

@interface Activityindicatorview ()

{

Uiimageview *_imageview;

UILabel *_label;

}

@end

@implementation Activityindicatorview

-(ID) initWithFrame: (cgrect) frame

{

Self = [super Initwithframe:frame];

if (self)

{

Nsmutablearray *images = [nsmutablearray array];

For (int i = 1; I <= 8; i++)

{

nsstring *imagename = [nsstring stringWithFormat:@"activity_0%d. PNG", I];

NSString *path = [[NSBundle mainbundle] pathforauxiliaryexecutable: imageName];

UIImage *image = [UIImage imagewithcontentsoffile:p ath];

[Images addobject:image];

}

_imageview = [[Uiimageview alloc] init];

_imageview. bounds = CGRectMake (0, 0, + );

_imageview. Center = Cgpointmake(cgrectgetmidx(selfBounds), Cgrectgetmidy( Self . bounds));

_imageview. animationimages = images;

_imageview. Animationduration = 1. 0;

_imageview. Animationrepeatcount = 0;

[self addsubview:_imageview];

_label = [[UILabel alloc]initwithframe: CGRectMake(screen_width / 2 - (+ )];

_label. Text = @" Network load, please wait ...";

_label. Font = [Uifont systemfontofsize:];

_label. TextAlignment = Nstextalignmentcenter;

[_imageview addsubview: _label];

_label. alpha = 0. 0;

[_label release];

[_imageview release];

}

return self;

}

-(void) Start

{

_label. alpha = 1. 0;

[_imageview startanimating];

}

-(void) Stop

{

_label. alpha = 0. 0;

[_imageview stopanimating];

}

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.