Question

I have a weird case where I'm using the awesome SWRevealViewController from John Lluch to have 2 side navigation controllers (like the Facebook app) that slide out to the left and the right when a UIBarButtonItem is touched.

However - I need the front view controller to make sure to resign first responder whenever these actions happen, but the associated actions for those bar buttons happen in another View Controller class.

I need to either:

  1. Associate another action with the UIBarButtonItem that I can call in the view that needs to resign first responder OR
  2. Resign first responder for the main view either on ViewDidAppear for either of the side views, or in the SWRevealController class

Can you resign first responder for one view from another view controller?

Was it helpful?

Solution

you can do it using NSNotificationCenter as below.

//.m file:  
 [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(LoadTableBasedOnCorner:) name:@"LoadTable" object:nil]; 

in which class you use above addObserver, you have to implement that method.

//.m file from where you want to send action, call method as below.

[[NSNotificationCenter defaultCenter] postNotificationName:@"LoadTable" object:nil];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top