[英]SWTableViewCell Delegate methods are not being called
我是IOS的新手,所以我不确定100%为什么在我的SWTableViewCell实现中未调用委托方法(可在此处找到一个库: https : //github.com/CEWendel/SWTableViewCell )
我有一个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
Swipe手势正在各个单元格上注册并显示底层按钮,但是当我单击按钮时,不会触发委托方法:
-(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;
}
}
我已经在委托方法上设置了一个断点,但是当按下按钮时没有任何东西被击中。 有任何想法吗?
行单元格和SWTableViewCell
上的附件视图似乎存在问题。 该附件似乎抓住了触摸事件,并且没有将其传递给SWTableViewCell
创建的按钮。 目前,我已禁用了附件视图,并且按预期进行委托调用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.