I have an application using a TabBar. The default view loaded and displayed
(so this loads up first): FirstViewController:

#import <UIKit/UIKit.h>


@interface FirstViewController : UIViewController {

@public BOOL availableNetwork;

}


@property (readonly) BOOL availableNetwork;


- (BOOL) isDataSourceAvailable;


@end



In this class in the awakeFromNib, I am doing a network availability test
and setting that availableNetwork BOOL. This works fine.



 - (void)awakeFromNib {

availableNetwork = NO;

BOOL returnVal = [self isDataSourceAvailable];

availableNetwork = returnVal;

}



In another view controller class, I'd like to access that variable. So what
I have tried in it's viewDidLoad:


 #import "FirstViewController.h"


in the viewDidLoad:


 FirstViewController *fvDelegate = (FirstViewController *)[[UIApplication
sharedApplication] delegate];

BOOL online = FirstViewController.availableNetwork;

error:accessing unknown 'availableNetwork' class method

NSLog( @"Online: %d", online );

*
*

How do I properly access that var? I think this delegate approach is totally
wrong, but I'm a bit new to Obj-C and don't know the right way to approach
this.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to