Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm guessing the methods are <code>NSURLConnection</code> based. The data sending part might be <code>synchronous</code> which pauses the main <code>UIThread</code>, which is why the activityIndicator does not animate.</p> <p>A better way would be to move the data post part to another thread. Replace the following:</p> <pre><code>[indicator startAnimating]; [self submitSurveyAnswers]; [self submitSurveyAnswersOne]; [self submitSurveyAnswersTwo]; OnlineViewController*targetController=[[OnlineViewController alloc]init]; targetController.mynumber=mynumber; [self.navigationController pushViewController:targetController animated:YES]; </code></pre> <p>with:</p> <pre><code>[indicator startAnimating]; [NSThread detachNewThreadSelector:@selector(startPosting:) toTarget:self withObject:nil]; </code></pre> <p>and create two methods:</p> <pre><code>-(void)startPosting{ [self submitSurveyAnswers]; [self submitSurveyAnswersOne]; [self submitSurveyAnswersTwo]; } </code></pre> <p>&amp;</p> <pre><code>-(void)dataSubmissionComplete{ OnlineViewController*targetController=[[OnlineViewController alloc]init]; targetController.mynumber=mynumber; [self.navigationController pushViewController:targetController animated:YES]; } </code></pre> <p>and then call the method <code>dataSubmissionComplete</code>, when your data has been successfully submitted, on the main thread as:</p> <pre><code>[self performSelectorOnMainThread:@selector(dataSubmissionComplete) withObject:nil waitUntilDone:YES]; </code></pre> <p>This process is usually followed in such situations where the UI thread animates the activity indicator while data is fetched/posted on another thread in background.</p> <p><strong>Edit-</strong> If you want custom activity indicators, take a look at <a href="http://www.dejal.com/blog/opensource" rel="nofollow">this</a>, <a href="http://cocoawithlove.com/2009/04/showing-message-over-iphone-keyboard.html" rel="nofollow">this</a> and <a href="https://github.com/nachiket-webonise/iPhone-Custom-Activity-Indicator" rel="nofollow">this</a> open-source activity indicator files with tutorials.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload