Georg is right. Note that, as implemented, this will cause undefined behavior, since
index is
int , but the action method that it uses expects an object (
id ) there, not an
int . Action Method Signature:
- (void)methodName:(id)sender;
Or when used with Interface Builder:
- (IBAction)methodName:(id)sender;
( IBAction is an alias for void . The two are semantically different, but functionally identical.)
Where sender is the object that sent the action message - in this case, the object you created and assigned to the slot variable.
source share