i have an NSDictionary that contain in value and i need to get this value
i have tried to get the value using the following code:
[NSTimer scheduledTimerWithTimeInterval:0.01
target:self
selector:@selector(timerMovelabel:)
userInfo:
[NSDictionary dictionaryWithObject:var forKey:@"var1"]
, [NSMutableDictionary dictionaryWithObject:[NSNumber numberWithInt:23] forKey:@"var2"]
i have tried to get the value using the following methods
-
int intvar = [[[timer userInfo] objectForKey:@"var2"] intValue]; -
NSNumber *numbervar = [[timer userInfo] objectForKey:@"var2"];
NSInteger intvar = [num intValue]; -
Follows:
[self method:[[[timer userInfo] objectForKey:@"var2"] intValue]]; - (void)timerMovelabel:(NSTimer *)timer { //here i execute one of the steps 1,2 and 3 but i didn't get any result all values are null } - (void) method:(NSInteger)dir { NSLog(@"%d",dir); }
The setup of the timer appears to be wrong. You can not pass more than one dictionary to the userInfo parameter.
Try:
EDIT: Added repeats parameter, thanks Bavarious.