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 trial

iOS

Loading Indicator iOS

Hi guys, I need your help :)

I am creating an iOS application (a port of news published on web) with several views and segues. The first view is sort of a "select what you want" view. It has 2 options now (1. load xml content from web displayed in collection view, 2. load twitter feed). Users can acces both by clicking on a button. The segue works fine, but when I hit a "load news" button, it takes a while to load content (user can see only button pressed (blue state) and the view is shown in few seconds with content loaded. Is there any way to load view immidiatly with blank screen and only show loading indicator while the data from xml parser are parsed and displayed?). If so, how? (p.s. I am total newbie, be patient please :))

3 Answers

Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

You need to use Grand Central Dispatch so that you can run your data loading in a separate thread. Here's a great tutorial: http://www.raywenderlich.com/4295/multithreading-and-grand-central-dispatch-on-ios-for-beginners-tutorial

Thank you, Amit, I solved it two hours later with tutorial on NSURL Connection. Is there any particular advantage to use ASIHTTPRequest?

Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

Lots of advantages in using ASIHTTPRequest like synchronous & asynchronous requests, caching, authentication, etc. It's a feature rich library that adds everything needed for an app that involves a lot of networking. Personally I prefer AFNetworking.