Search code examples
objective-ciosuisplitviewcontroller

Dismiss Modal view on Popover row selected in iphone SDK


I present a modal view on a button Tapped.

In that view, I made a new view(extra view). In Extra view, i have a UITableView & a UIButton.

When i click on that button,i open a view (Leftview) in popOVer.Now, i want to dismiss the "Extraview" on click of leftView's Table row.

MY code is as follow:

// Leftside view:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

    [[NSNotificationCenter defaultCenter] postNotificationName:@"DismissModal"object:nil];

}

// Presented modal view.m


- (void)viewDidLoad
{

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(dismissModal:) name:@"DismissModal" object:nil];
}


-(void)dismissModal:(NSNotification *)notif
{

   [self dismissViewControllerAnimated:YES completion:nil];

}

My error is as follow:

[Reader_View dismissModal]: unrecognized selector sent to instance 0xb494e10 2013-01-08 16:12:00.468 AFFeedsReader[3449:1d903] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Reader_View dismissModal]: unrecognized selector sent to instance 0xb494e10


Solution

  • i solved this by implementing post notification.