Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You have to establish connection with your server e retrieve the value, following the sample cose</p> <p>test.php contains this instruction:</p> <pre><code>&lt;?php echo 40; ?&gt; </code></pre> <p>here sample viewController.m with progress view linked via Interface Builder</p> <pre><code>#import "ViewController.h" @interface ViewController () { IBOutlet UIProgressView *progressView; NSMutableData *receivedData; } @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; progressView.progressTintColor = [UIColor lightGrayColor]; progressView.trackTintColor = [UIColor grayColor]; progressView.progress = 0.0f; NSURLRequest *theRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://192.168.0.29/test.php"] cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:10.0]; NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; if (!theConnection) { UIAlertView *connectFailMessage = [[UIAlertView alloc] initWithTitle:@"NSURLConnection " message:@"Failed in viewDidLoad" delegate: self cancelButtonTitle:@"Ok" otherButtonTitles: nil]; [connectFailMessage show]; } } #pragma mark NSURLConnection Methods - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { receivedData = [NSMutableData data]; [receivedData setLength:0]; } - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { [receivedData appendData:data]; } - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { // inform the user UIAlertView *didFailWithErrorMessage = [[UIAlertView alloc] initWithTitle: @"NSURLConnection " message: @"didFailWithError" delegate: self cancelButtonTitle: @"Ok" otherButtonTitles: nil]; [didFailWithErrorMessage show]; } - (void)connectionDidFinishLoading:(NSURLConnection *)connection { NSString *dataString = [[NSString alloc] initWithData: receivedData encoding:NSUTF8StringEncoding]; progressView.progress = [dataString floatValue] / 100; } @end </code></pre>
 

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