Note that there are some explanatory texts on larger screens.

plurals
  1. POOutput label in UIViewController
    text
    copied!<p>I can link labels to ViewController.h in my main view. However, in the settings screen, the program won't let me output the label to the ViewController.h. Because of this, "testLabel" below, is marked as an undeclared identifier. I want the label to reflect whether the user is connected to the internet or not.</p> <p>ViewController.h</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; #import &lt;AVFoundation/AVFoundation.h&gt; #import "Reachability.h" @interface ViewController : UIViewController &lt;UIImagePickerControllerDelegate, UINavigationControllerDelegate&gt; { Reachability *internetReachableFoo; } - (IBAction)cameraButtonClicked:(id)sender; @property (strong, nonatomic) IBOutlet UIImageView *imageView; @property (weak, nonatomic) IBOutlet UILabel *testLabel; //Not linked @end </code></pre> <p>ViewController.m</p> <pre><code>- (void)testInternetConnection { internetReachableFoo = [Reachability reachabilityWithHostname:@"www.google.com"]; // Internet is reachable internetReachableFoo.reachableBlock = ^(Reachability*reach) { // Update the UI on the main thread dispatch_async(dispatch_get_main_queue(), ^{ testLabel.text = @"YAY Intrawebs!!"; }); }; // Internet is not reachable internetReachableFoo.unreachableBlock = ^(Reachability*reach) { // Update the UI on the main thread dispatch_async(dispatch_get_main_queue(), ^{ testLabel.text = @"Someone broke the internet"; }); }; [internetReachableFoo startNotifier]; } </code></pre> <p><img src="https://i.stack.imgur.com/aRTVg.png" alt="Settings Screen"></p>
 

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