Wiki source for ActivityView
Ok, we cheat, we do it all in Objective-C, mostly because there was a sample.
The constant kActivityIndicatorSize is your choice.
%%(language-ref)
- (void) turnActivityViewOn: (UIView *) currentView {
CGRect screenRect = [[UIScreen mainScreen] bounds];
#define kActivityIndicatorSize 80
CGRect activityFrame = CGRectMake((screenRect.size.width/2.0) - (kActivityIndicatorSize/2.0),screenRect.size.height/2.0,kActivityIndicatorSize, kActivityIndicatorSize);
self.activityView = [[UIActivityIndicatorView alloc] initWithFrame:activityFrame];
self.activityView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;
[window insertSubview: activityView aboveSubview: currentView];
[activityView release];
[activityView startAnimating];
}
- (void) terminateActivityView {
if (self.activityView == null)
return;
[activityView stopAnimating];
[activityView removeFromSuperview];
self.activityView = null;
}
%%
%%(language-ref)
turnActivityOn
ObjectiveCBridge performSelectorOnMainThreadDoNotWait:
[self sharedApplication delegate turnActivityViewOn: self keyPadController view ].
turnActivityOff
ObjectiveCBridge performSelectorOnMainThreadDoNotWait:
[self sharedApplication delegate terminateActivityView].
%%
The constant kActivityIndicatorSize is your choice.
%%(language-ref)
- (void) turnActivityViewOn: (UIView *) currentView {
CGRect screenRect = [[UIScreen mainScreen] bounds];
#define kActivityIndicatorSize 80
CGRect activityFrame = CGRectMake((screenRect.size.width/2.0) - (kActivityIndicatorSize/2.0),screenRect.size.height/2.0,kActivityIndicatorSize, kActivityIndicatorSize);
self.activityView = [[UIActivityIndicatorView alloc] initWithFrame:activityFrame];
self.activityView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;
[window insertSubview: activityView aboveSubview: currentView];
[activityView release];
[activityView startAnimating];
}
- (void) terminateActivityView {
if (self.activityView == null)
return;
[activityView stopAnimating];
[activityView removeFromSuperview];
self.activityView = null;
}
%%
%%(language-ref)
turnActivityOn
ObjectiveCBridge performSelectorOnMainThreadDoNotWait:
[self sharedApplication delegate turnActivityViewOn: self keyPadController view ].
turnActivityOff
ObjectiveCBridge performSelectorOnMainThreadDoNotWait:
[self sharedApplication delegate terminateActivityView].
%%