SWTableViewCell委托方法没有被调用

问题描述:

我是IOS新手,所以我不是100%确定为什么在我的SWTableViewCell实现中没有调用委托方法(可以在这里找到的库:https://github.com/CEWendel/SWTableViewCellSWTableViewCell委托方法没有被调用

我有一个tableViewController.h文件看起来像这样:

#import <UIKit/UIKit.h> 
#import "SWTableViewCell.h" 
#import <AVFoundation/AVFoundation.h> 

@interface ICIRecordingsViewController : UITableViewController <SWTableViewCellDelegate, AVAudioPlayerDelegate> 
@property (nonatomic, strong) NSArray *documentArray; 
@property (strong, nonatomic) AVAudioPlayer *audioPlayer; 
@property (strong, nonatomic) SWTableViewCell *previousCell; 
@end 

而且tableViewcontroller.m文件导入如下:

#import "ICIRecordingsViewController.h" 
#import "ICIRecordingCell.h" 

@interface ICIRecordingsViewController() 

@end 

的ICIrecordingCell.h文件中查找此:

#import <UIKit/UIKit.h> 
#import "SWTableViewCell.h" 

@interface ICIRecordingCell : SWTableViewCell 
@property (weak, nonatomic) IBOutlet UILabel *title; 
@property (weak, nonatomic) IBOutlet UIButton *playButton; 

@end 

而且ICIRecordingCell.m文件导入ICIRecordingCell.h

轻扫手势登记在单个细胞和揭示潜在的按钮,但当我点击按钮代理方法没有被触发:

-(void) swipeableTableViewCell:(SWTableViewCell *)cell didTriggerRightUtilityButtonWithIndex:(NSInteger)index{ 
    switch(index){ 
     case 0:{ 
      UIActionSheet *shareActionSheet = [[UIActionSheet alloc] initWithTitle:@"Share" delegate:nil cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Share on FaceBook", @"Share on Twitter", nil]; 
      [shareActionSheet showInView:self.view]; 

      [cell hideUtilityButtonsAnimated:YES]; 
      break; 
     } 
     case 1:{ 
      NSIndexPath *cellIndexPath = [self.tableView indexPathForCell:cell]; 
      //need to figure out how to delete the item from the file system 
      [self.tableView deleteRowsAtIndexPaths:@[cellIndexPath] withRowAnimation:UITableViewRowAnimationLeft]; 
      break; 
     } 
     default:break; 
    } 
} 

我已经设置了委托方法的断点,但没有当按钮被击中时,g会被击中。有任何想法吗?

+1

对于任何人都在摸索他们的头,以及SWTableViewCell是什么,[它是GitHub上的开源代码](https://github.com/CEWendel/SWTableViewCell)。 – 2014-09-12 23:38:56

+0

谢谢 - 是的,我会编辑我的问题 – 2014-09-12 23:42:47

+0

SWTableViewCell需要一个“委托”。你在哪里设置它? – 2014-09-12 23:47:03

在行单元上出现配件视图似乎存在问题,并且SWTableViewCell。该附件似乎抓取了触摸事件,并没有将其传递到由SWTableViewCell创建的按钮。目前,我禁用了辅助视图,并且正按预期发生委托调用。