活动指示器显示和隐藏在飞溅图像& UITableView的

时间:2011-05-11 07:51:13

标签: iphone

我想添加活动指标&显示当我选择didSelectRowAtIndexPath并隐藏在显示detailView页面时... plz帮助任何人......并提供任何示例代码。

2 个答案:

答案 0 :(得分:1)

-(void)showActivityViewer {
self.activityView = [[[UIView alloc] initWithFrame: CGRectMake(0, 0, self.view.window.bounds.size.width, self.view.window.bounds.size.height)] autorelease];
activityView.backgroundColor = [UIColor blackColor];
activityView.alpha = 0.5;

self.activityWheel = [[[UIActivityIndicatorView alloc] initWithFrame: CGRectMake(self.view.window.bounds.size.width / 2 - 12, self.view.window.bounds.size.height / 2 - 12, 24, 24)] autorelease];
activityWheel.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;
activityWheel.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin |
                                  UIViewAutoresizingFlexibleRightMargin |
                                  UIViewAutoresizingFlexibleTopMargin |
                                  UIViewAutoresizingFlexibleBottomMargin);
[activityView addSubview:activityWheel];
[self.view.window addSubview: activityView];
[[[activityView subviews] objectAtIndex:0] startAnimating];
}

-(void)removeActivityViewer {
[activityWheel removeFromSuperview];
[activityView removeFromSuperview];
self.activityWheel = nil;
self.activityView = nil;
}

答案 1 :(得分:0)

MBProgressHUD正是这样做的!查看https://github.com/jdg/MBProgressHUD