Question

In my app , i am using iCloud.

I want to show UIActivityIndicatorView when loading iCloud Document into my UITextView and after finished i want to hide UIActivityIndicatorView.

How can i check iCloud Document Loading and finished to show UIActivityIndicatorView?

Here is my code to load iCloud document into my UITextView.

[doc openWithCompletionHandler:^(BOOL success) {
                if(success)
                {
                    self.txtView.text = self.doc.noteContent;
                }

                else
                {
                    NSLog(@"Error");
                }
            }];
Was it helpful?

Solution

This is as simple as:

[self.myActivityIndicator startAnimating];
[doc openWithCompletionHandler:^(BOOL success) {
            [self.myActivityIndicator stopAnimating];
            if(success)
            {
                self.txtView.text = self.doc.noteContent;
            }

            else
            {
                NSLog(@"Error");
            }
        }];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top