开发者

UIProgressView+Activity Indicator View on a UITableView during data upload

开发者 https://www.devze.com 2023-02-17 02:03 出处:网络
I have a uitableview. I saw this 开发者_开发知识库\"effect\" and I would replay it: When the user taps on a button to upload some data on a server, I would a gray (transparent) view with a progress

I have a uitableview.

I saw this 开发者_开发知识库"effect" and I would replay it:

When the user taps on a button to upload some data on a server, I would a gray (transparent) view with a progress bar (maybe with also an activity indicator) appears on the table. The table is disabled and can be viewed through the gray view (that is the gray transparent view covers all the table).

How can I achieve this?

Have I create a view with a progressive view on it and then put it in the same xib of the table, disabling it properly programmatically? Or?


Lay a large black UIView over top of the UITableView with an alpha value of 0.5. Then put a spinner (UIActivityIndicatorView) on top of that.

Something like this:

UIView *view = [[UIView alloc] init];
view.frame = myTableView.frame;
// save this view somewhere

UIActivityIndicatorView *ac = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
CGRect frame = view.frame;
ac.center = CGPointMake(frame.size.width/2, frame.size.height/2);
[view addSubview:ac];
[ac startAnimating];
[ac release];

[myTableView addSubview:view];
[view release];

Then remove it later with [view removeFromSuperview]

0

精彩评论

暂无评论...
验证码 换一张
取 消