Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialStone Preston
42,016 Pointsimplementing a loading view while getting tableView data
Does anyone know how you would go about implementing a loading view (spinning circle type thing) while the tableView is being populated with data?
2 Answers
Rashii Henry
16,433 PointsYou can use that suggestion or either:
create a new property of UIRefreshControl in your header file.
switch to your implementation then alloc and initialize the property you created. self.refreshControl = [UIRefreshControl alloc] init]; //this will automatically create the spinning circle. so if you run the program it will work but continue to spin.
make sure after you allocate and initialize the UIRefreshControl you use: [self.refreshControl addTarget:self action:@selector(whateverActionYouWillUse) forControlEvent:UIControlEventValueChanged];
then to get the circle to disappear whenever you finish retrieving something you can do something like: if ([self.resfreshControl isRefreshing]) {self.refreshControl endRefreshing};
just a suggestion.
John W
21,558 PointsYou can imitate pull-to-refresh by
[self.refreshControl beginRefreshing];
self.tableView.contentOffset = CGPointMake(0,-100);
Then when you are done:
[self.refreshControl endRefreshing];
self.tableView.contentOffset = CGPointMake(0,0);
Stone Preston
42,016 Pointsawesome ill try this out
Stone Preston
42,016 PointsStone Preston
42,016 Pointsthanks for the suggestion. I actually followed this tutorial to make a more customizable loading indicator.
Rashii Henry
16,433 PointsRashii Henry
16,433 PointsI appreciate it.
I've actually been looking for one so i'll take a look at it now.