Hi at all, I have a little problem, I have a function that pass to a var a number, then I pass this var to a method that return this value, at the end I pass this value to another class.
If I define PassTag with 1,2 or 3 it work perfectly (I see on console the correct value), if I use PassTag = TAG the variable pass 0 instead 1,2 or 3.
A strange thing is that in varID put an NSLog that was print 2 times (instead 1) and the first stamp is correct while the second print is 0.
Any tips?
Code:
ListView.h
//Variabili
int TAG;
int PassTag;
}
- (void) listener:(id) sender;
- (int) varID;
Code:
ListView.m
- (void) listener:(id) sender
{
.....
TAG = [[co id] intValue];
[self varID];
....
[detailArg release];
}
- (int) varID
{
// PassTag = 1; WORK
PassTag = TAG; // NOT WORK
NSLog(@"Tag = %d",PassTag);
return PassTag;
}
Code:
controller2.m
ListView *my_ID = [[ListView alloc] init];
variabileID = [my_ID varID];
NSLog(@"VariabileID da lettura database = %d",variabileID);