Ios EditingStyleForRowatineXpath和DidSelectRowatineXpath都不工作

Ios EditingStyleForRowatineXpath和DidSelectRowatineXpath都不工作,ios,objective-c,uitableview,Ios,Objective C,Uitableview,我有TableViewCell.xib文件,其中每个单元格都可以是数据摘要,如姓名、联系人等。现在,如果我触摸该单元格,它将转到另一个ViewController,其中将显示该单元格的数据细节。(无论此ViewController显示什么)。我想从此xib文件的cell touch转到另一个ViewController。我该怎么做呢 CallHistoryTableViewCell.h @interface CallHistoryTableViewCell : UITableViewCell @

我有
TableViewCell.xib
文件,其中每个单元格都可以是数据摘要,如姓名、联系人等。现在,如果我触摸该单元格,它将转到另一个ViewController,其中将显示该单元格的数据细节。(无论此ViewController显示什么)。我想从此xib文件的cell touch转到另一个ViewController。我该怎么做呢

CallHistoryTableViewCell.h

@interface CallHistoryTableViewCell : UITableViewCell
@property(nonatomic, strong) IBOutlet UILabel *contactName;
@property(nonatomic, strong) IBOutlet UILabel *contactNumber;
@end
@interface CallHistoryVC : UIViewController
@end
此类具有
CallHistoryTableViewCell.xib
文件

CallHistoryVC.h

@interface CallHistoryTableViewCell : UITableViewCell
@property(nonatomic, strong) IBOutlet UILabel *contactName;
@property(nonatomic, strong) IBOutlet UILabel *contactNumber;
@end
@interface CallHistoryVC : UIViewController
@end
CallHistoryVC.m

#import "CallHistoryVC.h"
#import "CallHistoryTableViewCell.h"

@interface CallHistoryVC ()<UITableViewDelegate, UITableViewDataSource,CallingViewControllerDelegate> {
AppDelegate *appDelegate;

}
@property (nonatomic, strong) NSMutableArray<RecentCall> *sortedEventArray;
@property (weak, nonatomic) IBOutlet UITableView *tView;

@implementation CallHistoryVC

- (void)viewDidLoad {
[super viewDidLoad];
appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;

[self defaultViewSetting];
_tView.delegate = self;
_tView.dataSource = self;
_tView.allowsSelectionDuringEditing = YES;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 75;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return _sortedEventArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"CallHistoryTableViewCell";
CallHistoryTableViewCell *cell = (CallHistoryTableViewCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
return cell;
}

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{

return UITableViewCellEditingStyleDelete;
}

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
 //do something
}
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

NSLog(@"%ld",(long)indexPath.row);
}
@end
#导入“CallHistoryVC.h”
#导入“CallHistoryTableViewCell.h”
@接口CallHistoryVC(){
AppDelegate*AppDelegate;
}
@属性(非原子,强)NSMutableArray*sortedEventArray;
@属性(弱、非原子)IBUITableView*tView;
@实现CallHistoryVC
-(无效)viewDidLoad{
[超级视图下载];
appDelegate=(appDelegate*)[UIApplication sharedApplication]。委派;
[默认视图设置];
_tView.delegate=self;
_tView.dataSource=self;
_tView.AllowSelectionDuringEditing=是;
}
-(NSInteger)表格视图中的节数:(UITableView*)表格视图
{
返回1;
}
-(CGFloat)tableView:(UITableView*)表视图行高度索引路径:(NSIndexPath*)索引路径{
返回75;
}
-(NSInteger)表视图:(UITableView*)表视图行数节:(NSInteger)节{
返回_sortedventarray.count;
}
-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath{
静态NSString*CellIdentifier=@“CallHistoryTableViewCell”;
CallHistoryTableViewCell*单元格=(CallHistoryTableViewCell*)[tableView出列重用CellWithIdentifier:CellIdentifier];
返回单元;
}
-(UITableViewCellEditingStyle)tableView:(UITableView*)tableView editingStyleForRowAtIndexPath:(NSIndexPath*)indexPath
{
返回UITableViewCellEditingStyleDelete;
}
-(void)tableView:(UITableView*)tableView提交的编辑样式:(UITableViewCellEditingStyle)行的编辑样式索引路径:(NSIndexPath*)索引路径{
如果(editingStyle==UITableViewCellEditingStyleDelete){
//做点什么
}
}
-(void)tableView:(UITableView*)tableView未选择RowatineXpath:(NSIndexPath*)indexPath{
NSLog(@“%ld”,(长)indexath.row);
}
@结束
现在的问题是,我的
editingStyleForRowAtIndexPath
工作正常,但没有调用
didSelectRowAtIndexPath
。我经历了许多解决方案,并添加了一行
\u tView.allowSelectionDuringEdit=YES但不工作

请帮忙

截图:


您是否在TableView中看到该列表?如果是,请共享您的屏幕截图。添加的屏幕截图请检查。由于您正在为CallHistoryTableViewCell使用XIB文件,您是否在ViewDidLoad中注册了CallHistoryTableViewCell单元格?我看不到代码。太好了!!!它起作用了。没有注册除DidSelectRowatineXpath之外的所有工作。在viewDidLoad中注册xib文件是否需要打开?因为我在CellForRowatineXpath注册了手机。请你给我解释一下。检查一下:你在TableView中看到列表了吗?如果是,请共享您的屏幕截图。添加的屏幕截图请检查。由于您正在为CallHistoryTableViewCell使用XIB文件,您是否在ViewDidLoad中注册了CallHistoryTableViewCell单元格?我看不到代码。太好了!!!它起作用了。没有注册除DidSelectRowatineXpath之外的所有工作。在viewDidLoad中注册xib文件是否需要打开?因为我在CellForRowatineXpath注册了手机。请你给我解释一下。检查一下: