I'm trying to subclass a TableView, and a method isn't getting called.
in the TouchTableView.h I have
#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>
#import "SimpleTableCell.h"
@protocol myTableViewDelegate;
@interface TouchTableView : UITableView <UITableViewDelegate, UITableViewDataSource, AVAudioRecorderDelegate, AVAudioPlayerDelegate, UITextViewDelegate, UITextFieldDelegate, UIAlertViewDelegate>
@property (nonatomic, assign) id<myTableViewDelegate> myDelegate;
@property (strong, nonatomic) NSMutableArray *sortedFiles;
@property (strong, nonatomic) NSString *simpleTableIdentifier;
@property (strong, nonatomic) SimpleTableCell *cell;
@property BOOL inverted;
-(void)refreshTable;
@end
@protocol myTableViewDelegate <NSObject>
- (void)selectedFile:(TouchTableView *)tableView withURL: (NSURL *) tableViewURL IndexPath:(NSIndexPath *)indexPath;
-(void)didDelete:(TouchTableView *)tableView IndexPath:(NSIndexPath *)indexPath;
-(void)setSortedFile:(TouchTableView *)tableView;
@end
and in the TouchTableView.m I have the method
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSArray *folders = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsFolder = [folders objectAtIndex:0];
NSString *dataPath = [documentsFolder stringByAppendingPathComponent:@"/Audio"];
NSString *fileName = [NSString stringWithFormat:@"%@/%@",dataPath,[[sortedFiles objectAtIndex:indexPath.row] objectForKey: @"path"]];
NSURL *tableViewUrl = [NSURL fileURLWithPath:fileName isDirectory:
NO];
if ([self.myDelegate respondsToSelector:@selector(selectedFile:withURL:IndexPath:)]) {
[self.myDelegate selectedFile:self withURL:tableViewUrl IndexPath:indexPath];
}
}
It appears that the self.delegate doesn't respond to the selector. It skips over and doesn't go to the method. What am I doing wrong?