
attempting to set a swipe to delete cell when we already have one....that doesn't seem good
码:
#import "GroupDetailinfoVIEwController.h"#import "YFJleftSwipeDeletetableVIEw.h"@interface GroupDetailinfoVIEwController (){ NSMutableArray * _dataArray; UIbutton * _deletebutton; NSIndexPath * _editingIndexPath; UISwipeGestureRecognizer * _leftGestureRecognizer; UISwipeGestureRecognizer * _rightGestureRecognizer; UITapGestureRecognizer * _tapGestureRecognizer;}@property (nonatomic,retain) YFJleftSwipeDeletetableVIEw *tableVIEw;@end@implementation GroupDetailinfoVIEwController- (ID)init{ self = [super init]; if (self) { // Custom initialization _dataArray = [@[@(1),@(2),@(3),@(4),@(5),@(6),@(7),@(8),@(9),@(10)] mutablecopy]; } return self;}- (voID)vIEwDIDLoad{ [super vIEwDIDLoad]; // Do any additional setup after loading the vIEw from its nib. CGRect frame = self.vIEw.bounds; self.tableVIEw = [[YFJleftSwipeDeletetableVIEw alloc] initWithFrame:frame]; self.tableVIEw.delegate = self; self.tableVIEw.dataSource = self; [self.tableVIEw registerClass:[UItableVIEwCell class] forCellReuseIDentifIEr:@"Cell"]; [self.vIEw addSubvIEw:self.tableVIEw];}#pragma mark - table vIEw data source- (NSInteger)numberOfSectionsIntableVIEw:(UItableVIEw *)tableVIEw{ // Return the number of sections. return 1;}- (NSInteger)tableVIEw:(UItableVIEw *)tableVIEw numberOfRowsInSection:(NSInteger)section{ // Return the number of rows in the section. return _dataArray.count;}- (UItableVIEwCell *)tableVIEw:(UItableVIEw *)tableVIEw cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static Nsstring *CellIDentifIEr = @"Cell"; UItableVIEwCell *cell = [tableVIEw dequeueReusableCellWithIDentifIEr:CellIDentifIEr forIndexPath:indexPath]; cell.textLabel.text = [Nsstring stringWithFormat:@"Data at Row %@",_dataArray[indexPath.row]]; return cell;}// OverrIDe to support conditional editing of the table vIEw.- (BOol)tableVIEw:(UItableVIEw *)tableVIEw canEditRowAtIndexPath:(NSIndexPath *)indexPath{ // Return NO if you do not want the specifIEd item to be editable. return YES;}// OverrIDe to support editing the table vIEw.- (voID)tableVIEw:(UItableVIEw *)tableVIEw commitEditingStyle:(UItableVIEwCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{ if (editingStyle == UItableVIEwCellEditingStyleDelete) { // Delete the row from the data source [_dataArray removeObjectAtIndex:indexPath.row]; [tableVIEw deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UItableVIEwRowAnimationFade]; }}- (voID)tableVIEw:(UItableVIEw*)tableVIEw willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath{ NSLog(@"willBeginEditingRowAtIndexPath"); //[super setEditing:YES animated:YES]; [self.tableVIEw setEditing:YES animated:YES]; //Self.editing handles the done / edit button tableVIEw.editing = YES;}- (UItableVIEwCellEditingStyle)tableVIEw:(UItableVIEw *)tableVIEw editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath{ UItableVIEwCellEditingStyle editingStyle = UItableVIEwCellEditingStyleNone; /*if (tableVIEw.editing)*/ editingStyle = UItableVIEwCellEditingStyleDelete; return editingStyle;}- (voID)tableVIEw:(UItableVIEw*)tableVIEw dIDEndEditingRowAtIndexPath:(NSIndexPath *)indexPath{ NSLog(@"dIDEndEditingRowAtIndexPath"); //[super setEditing:NO animated:YES]; [self.tableVIEw setEditing:NO animated:YES]; //Self.editing handles the done / edit button tableVIEw.editing = NO;}- (BOol)tableVIEw:(UItableVIEw *)tableVIEw shouldindentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath { return NO;}- (voID)tableVIEw:(UItableVIEw *)tableVIEw dIDSelectRowAtIndexPath:(NSIndexPath *)indexPath { [self.tableVIEw deselectRowAtIndexPath:indexPath animated:YES];}- (CGfloat)tableVIEw:(UItableVIEw *)tableVIEw heightForRowAtIndexPath:(NSIndexPath *)indexPath { return 44;}@end解决方法 添加SWtableVIEwCell后我遇到了同样的问题.我已经实现后添加了SWtableVIEwCell – (voID)tableVIEw:(UItableVIEw)tableVIEw commitEditingStyle:(UItableVIEwCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath *. 一旦我删除了这个方法,事情按预期工作.我猜SWtableVIEwCell安装的视图与尝试基于此方法安装相同类型的视图的系统冲突.
总结以上是内存溢出为你收集整理的ios – 尝试设置滑动以删除单元格,当我们已经有一个…这看起来不太好全部内容,希望文章能够帮你解决ios – 尝试设置滑动以删除单元格,当我们已经有一个…这看起来不太好所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)