سؤال

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?

هل كانت مفيدة؟

المحلول

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];

نصائح أخرى

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:)];

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top