I am very new to Objective-c and probably really easy to solve but couldnt find an answer anywhere....
I am trying to add +1 to a variable every time the user clicks on the button but instead of adding +1 it adds +4
- (IBAction)addNewSet:(UIButton *)sender {
NSLog(@"%i",_sliderTag);
_sliderTag += 1;
NSLog(@"ADD NEW %i",_sliderTag);
}
_sliderTag
is already an NSInteger
:
@property (nonatomic,assign) NSInteger* sliderTag;
The first NSLog
prints 0
and the 2nd after the add is performed prints 4
. Could anyone explain why? It is meant to print 0
the first one, as the point of this variable is to be a counter for setting tags.