I'm trying to create a method inside another method which is then passed into my timer. I'm stuck on the selector
section of NSTimer and have no idea how to pass my method into it. I figured I would be able to pass it like I usually do: [self methodHere:parameter]
but it's not working.
I get two warnings on the bgTimer = [NStimer....
line in viewDidLoad:
- ! expected identifier
- ! expected "]"
.m
- (void)viewDidLoad {
[super viewDidLoad]
timer = [NSTimer scheduledTimerWithTimeInterval:animationDuration target:self selector:@selector([self bgColorCycleWithOutlet:bgColor]) userInfo:nil repeats:YES];
}
- (void)bgColorCycleWithOutlet:(UIButton *)outlet {
if (time == 0) {
[self bgColorSwatchAnimationRed:232
green:152
blue:58
duration:5
outlet:outlet];
}
}
- (void)bgColorSwatchAnimationRed:(float)r green:(float)g blue:(float)b duration:(int)d outlet:(UIButton *)o {
[o setBackgroundColor:[UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:0.5]];
[UIView animateWithDuration:d animations:^{
[o setBackgroundColor:[UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1]];
}];
}