forum

Home / DeveloperSection / Forums / can i Pass gesture recogniser in a notification

can i Pass gesture recogniser in a notification

Anonymous User148320-Jul-2015

I am sending a notification from one class to another to call a method using

[[NSNotificationCenter defaultCenter] postNotification:

[NSNotification notificationWithName:@"gestureIsOn" object: self ]];

WhatI want to achieve here is to receive the notification in another class but also passing the UIGestureRecognizer to find which view it is, as the class receiving the notification contains 4 different views. I already tried to implement the receiving of the notification like this:

[[NSNotificationCenter defaultCenter] addObserver:self

                                             selector:@selector(handleGestures::) name:@"gestureIsOn"

                                             object:nil ];

and call the method handleGestures:

-(void)handleGestures:(UIGestureRecognizer *)sender :(NSNotification *)notification { 

if(sender.view == view1)

do something

}

Tried to use double :: in my observer notification but this causing an error of Terminating app due to uncaught exception 'NSInvalidArgumentException'

Thanks in advance to everyone that spend time reading this.


Updated on 20-Jul-2015
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By