Question

I am trying to add a NSIndexpath as parameter to a method through

[self action:@selector(showDetailedImage)];

Is it possible to add an extra parameter(NSIndexPath) to this method?

Was it helpful?

Solution

No, you can not pass arguments, you can only show that this selector will take that many numbers of arguments.

If you need to do this, you can create a property and access it from the method showDetailedImage.

However you can use this selector:

[self performSelector:@selector(showDetailedImageIndex:) withObject:objectOfNSIndex];

OTHER TIPS

Make a wrapper(another method) say -(void)wrapperMethodOforiginalSelectorMethod; of your now-selector-method say -(void)originalSelectorMethod:(id)argument; and make the wrapper as your new selector which further calls your originalSelectorMethod with your argument.

You have to add extra parameter to

ShowDetailedImage:(NSIndexPath *)indexPath

can call [self action:@selector(showDetailedImage:)];

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top