first of all here is my code:
@protocol SearchTableViewControllerDelegate
@required
- (void)didSelectFileCardsContent:(FileCardsContent*)content;
@end
@interface SearchTableViewController : UITableViewController <UISearchBarDelegate, UISearchDisplayDelegate>{
id <SearchTableViewControllerDelegate> delegate;
...
}
@property (nonatomic, assign) id <SearchTableViewControllerDelegate> delegate;
...
@end
---------------------------------------------------
@implementation SearchTableViewController
@synthesize ... delegate;
...
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
FileCardsContent *fileCardToShow = [self.tableData objectAtIndex:indexPath.row];
[self.delegate didSelectFileCardsContent:fileCardToShow];
}
...
@end
---------------------------------------------------
@interface FileCardsViewCotroller : UIViewController <SearchTableViewControllerDelegate>{
...
@end
---------------------------------------------------
@implementation FileCardsViewCotroller
...
- (void)didSelectFileCardsContent:(FileCardsContent*)content{
[managedFileCards insertSingleContent:content];
self.currentFileCardsContent = content;
questionView1.text = currentFileCardsContent.question;
}
@end
My problem is – (void)didSelectFileCardsContent:(FileCardsContent*)content in FileCardsViewCotroller is never called.
There are no compiler warnings or errors. I`m not familiar with protocols and delegates so is suggest there is a conceptually problem.
Anny ideas?
You just aren’t assigning your delegate to anything so the message is sent to nil.