Question: I am new to iPhone development. I created an application in which the first tab bar view loads a web page and in second tab bar view, it parses a xml file and display the content in the table view.

When I click the second tab bar, the tab bar view is seen only after the parsing is done, till the parsing time the tab bar appears like unselected. I want to display the tabbar view with activity indicator when the parsing is done. How can I achieve it?

Answer: 
Without additional information about is difficult to tell, but I guess you are parsing the XML file inside `viewDidLoad()` or `loadView(`). However, parsing may actually require time, and you are blocking the main thread which is responsible for updating the UI. This is the reason why you are seeing the tab bar only after parsing is completed.

To remedy this situation, you need to defer your table view showing data, display an activity indicator to tell your users that something is going on, and start a background thread in charge of parsing your XML file.The thread processing the XML file once done then stops the activity indicator and setup your table view with the parsed data.

You can do this very easily using the API available (`detachNewThreadSelector:toTarget:withObject:` and `performSelectorOnMainThread:withObject:waitUntilDone:` etc), however, you may want to consider taking advantage of [MBProgressHUD](http://github.com/jdg/MBProgressHUD) which provides exactly the functionality you need wrapped in a very easy to use class.
1. don't do parsing in the MainThread, detach a new thread to do parsing (**[NSThread detachNewThreadSelector:toTarget:withObject:]**)
2. after parsed (**parserDidEndDocument:**) use **performSelectorOnMainThread** to refresh the tableView.