2014-09-12 138 views
0

我是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

回答

0

在行單元上出現配件視圖似乎存在問題,並且SWTableViewCell。該附件似乎抓取了觸摸事件,並沒有將其傳遞到由SWTableViewCell創建的按鈕。目前,我禁用了輔助視圖,並且正按預期發生委託調用。

相關問題