UIActivityIndicator
Non classé 6 Comments »Create a UIActivityIndicator :
Declare the following variables in your .h :
BOOL isWaiting;
NSInteger waitingCounter;
UIView* waitingScreen;
UIActivityIndicatorView* waitingSreenActivityIndicator;
In your .m implement a method you’ll call when needed :
- (void) showMyWaitingScreen{
if (waitingCounter == 0) {
if(!waitingScreen){
//init waiting view
waitingScreen = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
waitingScreen.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.2];
waitingSreenActivityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
[waitingScreen addSubview:waitingSreenActivityIndicator];
}
isWaiting = YES;
waitingScreen.hidden = NO;
[waitingSreenActivityIndicator startAnimating];
[self.view.window addSubview:waitingScreen];
}
waitingCounter++;
}
Recent Comments