Hi guys, I'm having a VERY tough time getting an activity indicator to appear.
I have a button that is pressed, and basically when the button is pressed it's linked to a method called process, when process runs I'm assigning the ActivityIndicator object an activity indicator, and attemting to addSubView it, then start animation, so the method will finish processing and at the end do StopAnimation etc.
For some reason it doesn't even display at all... I've googled heaps of examples and they all appear to be doing it the same way, here is a snippet of code:
P.S the payment client object contains a whole bunch of C functions that are being called from withing that "DO PROCESSING HERE" section. I'm not multi threading anything if you're curious.
If the processing is a long task done on the main thread, the UIActivityIndicator won't appear. You should do any long tasks on a background thread, then notify the UI of the changes on a background thread.
Also, no need for "return;" at the end of a function, because it's returning anyway and if you're not going to use your activityIndicator property, there's no need for it.
Last edited by harrytheshark; 07-29-2010 at 07:54 AM.
If the processing is a long task done on the main thread, the UIActivityIndicator won't appear. You should do any long tasks on a background thread, then notify the UI of the changes on a background thread.
Also, no need for "return;" at the end of a function, because it's returning anyway and if you're not going to use your activityIndicator property, there's no need for it.
Thanks for your reply Harry! I'll give it a crack and report back if I have any dramas.
I'm guessing I need to create a new thread and parse in the theProcess function in the processPayment method?
As for the return statement, I'm coming from a C background
Anytime you are doing a lot of processing/downloading of data you will want to do it on a different thread. Doing it on the main thread will lock up the UI which means not only will the activityIndicator not appear but the user won't be able to do anything else either. To the users eyes the app is frozen and more than likely they will simply close it which is certainly bad for business.
__________________
I'm starting a new blog dedicated to iOS development. Check it out at: