So i have two view controllers home, second. I create a variable in home and want to call it in the second UIViewController. I get an error saying:
Use of undeclared identifier 'plusNumber'
Please let me know why i am not connecting the second UIViewController with the variable in home. I imported the header file home.h into the second.h file.
Thanks.
Code is below: home.h
@interface homeViewController : UIViewController <UIAlertViewDelegate>
{
int plusNumber;
}
- (IBAction)plusSign:(id)sender;
home.m
- (IBAction)plusSign:(id)sender {
if(self.plusNumber == 0)
{
self.plusNumber = @"1";
}
else
{
self.plusNumber = @"0";
}
}
second.h
#import "home.h"
@property (weak, nonatomic) IBOutlet UILabel *output;
second.m
- (void)viewDidLoad
{
[super viewDidLoad];
self.output.text = [NSString stringWithFormat:@"%i", plusNumber];
}