let for consider the code
one.h
#import "historyViewController.h"
int isItfsa;
one.m
-(IBAction)homeHistory:(id)sender{
isItfsa = 0;
historyViewController *hisVController = [[historyViewController alloc]initWithNibName:@"historyViewController" bundle:nil];
[self presentModalViewController:hisVController animated:YES];
[hisVController release];
}
But when i receive it does not print //0
but in 2nd class two.m
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
NSLog(@"isItfsa=%@",isItfsa); //isItfsa=null
}
it is print null ,but why? and how i can pass the value from one class to another class by method.
Null is the same value as zero. It writes “null” because you don’t tell it to write an integer, you are telling it to write an object.
Your code:
NSLog(@"isItfsa=%@",isItfsa)(writeisItfsaas object)It should be:
NSLog(@"isItfsa=%i",isItfsa)(writeisItfsaas integer)