Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 10-07-2009, 09:00 AM   #1 (permalink)
Registered Member
 
Join Date: Jan 2009
Location: London, UK
Posts: 12
Default UITabBarController & UIActivityIndicatorView

I cannot figure this one out. Any help much appreciated..


I have a programmatic UITabBarController which has 4 tabs.

When someone selects one of the tabs (all of which are instances of the main viewController), the subsequent viewDidLoad method will trundle off and fetch some XML from the server and parse it.

As there is a slight delay while it does this, what I want to happen is for a UIActivityIndicatorView to appear when someone selects a new tab and then to disappear when the NSXMLParser delegate (in this case, self) responds to parserDidEndDocument.

When I stick a NSLog at the beginning of the viewDidLoad it appears instantly in the Console and when NSLog in parserDidEndDocument, similarly there is no delay. However, when I stick in an UIActivityIndicatorView in there, it won't appear at all.

I have figured that this is because I am using

[self.view addSubview:activityIndicator];

which is adding a view to the new viewController which hasn't loaded yet.


Question:

What is the correct procedure for doing this?
Should I be adding a subview to the main window first?
Should I be adding a subview to the old viewController view? Then removing it when the user steps back?


There is probably an easy answer for all of this but I can't see the wood from the trees. I'm staring at hundreds of lines of code breaking out into a cold sweat.

If anyone could help out, I would be really grateful.
eagerterrier is offline   Reply With Quote
Old 03-04-2010, 06:41 AM   #2 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 25
Default

have you tried adding it to the tabcontroller view?

self.tabBarController.view
__________________
A hopeful games developer
iMediLog
Save With Katie
Containment
Containment FREE
Flexicoder is offline   Reply With Quote
Old 03-04-2010, 12:34 PM   #3 (permalink)
Registered Member
 
Join Date: May 2009
Location: Denver CO
Posts: 88
Default

Having done some thing very similar, I would have a "populate" method that gets loaded from the new view controller. So in your viewDidLoad method, you would (in this order)

1-Add the activity indicator, start animating.
2-Start your XML parsing methods.

When your XML is done parsing, then you setup the view, populate your tables, etc.

There are probably 75 billion ways to do this, but that's how I have done this in the past.
seriessix is offline   Reply With Quote
Reply

Bookmarks

Tags
uiactivityindicatorview, uinavigationcontroller, uitabbarcontroller, viewdidload

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 272
22 members and 250 guests
ADY, AragornSG, Bertrand21, Dani77, Dattee, fkmtc, HDshot, iDifferent, jakerocheleau, JasonR, jimbo, macquitzon216, mer10, prchn4christ, Rudy, sacha1996, silverwiz, sneaky, spiderguy84, Sunny46, theone8one
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,885
Threads: 89,230
Posts: 380,767
Top Poster: BrianSlick (7,129)
Welcome to our newest member, bookesp
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:07 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0