开发者

Add Background Image While Hidden Tableview Loads Data

开发者 https://www.devze.com 2023-03-05 16:13 出处:网络
I\'m pulling in an RSS feed and would like to have a background image while the data is loading instead of a bunch of empty cells.

I'm pulling in an RSS feed and would like to have a background image while the data is loading instead of a bunch of empty cells.

While the data is 开发者_开发问答loading I hide the tableview (not sure if this is the right thing to do for the time being) and I'm left with a white screen. Is this white screen left over the UIWindow? I'm just trying to get a better idea of what property or object I must modify to show an image while a tableview is hidden.

Thanks


The concept here is to add a subview to the window property after the TableView, in order that the new view hides the Table:

In AppDelegate:

[self.window addSubview:tableView];
[self.window addSubview:imageOverTableView];

Then in imageOverTableView you can have a turning spinner while you're loading the RSS. When the RSS is done, you can animate imageOverTableView to disappear like:

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration: 0.7];
imageOverTableView.alpha = 0.0f;
[UIView commitAnimations];

or simply [imageOverTableView removeFromSuperview]; without animation

0

精彩评论

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

关注公众号