Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do pretty UIActivityIndicatorView

I saw once a library that can do nice UIActivityIndicatorView easily but I can not find it. Someone knows or knows another way to make nice UIActivityIndicatorView ? something like that http://hpics.li/64d7b07

like image 402
Keviin55 Avatar asked Nov 28 '22 14:11

Keviin55


1 Answers

I just did something similar today. I'm going to make it a proper subclass, but for now, this should get you started. Adding a UILabel should be easy for you. I'm doing this with ARC so if you need to do memory management please be careful.

UIView *activityContainer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
activityContainer.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:.25];
UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake((self.view.frame.size.width/2) - 40, (self.view.frame.size.height/2) - 40, 80, 80)];
indicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;
indicator.backgroundColor = [UIColor blackColor];
[indicator layer].cornerRadius = 8.0;
[indicator layer].masksToBounds = YES;
[activityContainer addSubview:indicator];
like image 95
sosborn Avatar answered Dec 22 '22 08:12

sosborn