I had the UIActivityIndicatorView working fine in simulator and other 3.0 devices in my app. But I found out that it was not spinning (or showing) in the new iphone 4. Basically I need to show the activity indicator when a button is clicked and hide it when the button click event is complete. I was using the approach below.
[NSThread detachNewThreadSelector: @selector(spinBegin) toTarget:self withObject:nil];
from this link. As mentioned, it correctly spins the activity indicator on all except 4.*.. not sure why. To get around this, I also followed another approach something like (from developer.apple.com)
` (IBAction)syncOnThreadAction:(id)sender
{
[self willStartJob]; [self performSelectorInBackground: @selector(inThreadStartDoJob:) withObject:theJobToDo ]; }
(void)inThreadStartDoJob:(id)theJobToDo
{
NSAutoreleasePool * pool; NSString * status; pool = [[NSAutoreleasePool alloc] init]; assert(pool != nil); status = [... do long running job specified by theJobToDo ...] [self performSelectorOnMainThread: @selector(didStopJobWithStatus:) withObject:status waitUntilDone:NO ]; [pool drain]; }
`
The problem with this was that, it is showing the acitivityVIewIndicator spinning correctly (at least on the simulator) but after it stops, the built in activity indicator in the top bar (where it shows the battery% etc) is still spinning.
I'm new to objective C. I have finished my app completely but for this silly thing. I realize there is no way to display UIActivityView without starting another thread. and finally, just to rant, I don't understand why they have to make it so complicated. I mean they knew it was going to have this problem, why not provide a sample code everyone can use rather than deriving their own solutions.
Finally, can anyone please provide me with a direction or some sample code. I would really appreciate it. I have been searching for a few hours now and have not found anything really that works!