Ios UITableView选择不工作的序列
我是iOS新手,我不明白为什么当我点击单元格中的项目时,它什么地方都没有。没有错误,什么都没有。我的序列号是手机。我有一个按钮,可以很好地添加数据,但如果从表中选择,我会尝试更新数据 这是我的Ios UITableView选择不工作的序列,ios,objective-c,uitableview,Ios,Objective C,Uitableview,我是iOS新手,我不明白为什么当我点击单元格中的项目时,它什么地方都没有。没有错误,什么都没有。我的序列号是手机。我有一个按钮,可以很好地添加数据,但如果从表中选择,我会尝试更新数据 这是我的.h和.m DerbyProTableViewController.h: #import <UIKit/UIKit.h> @interface DerbyProTableViewController : UITableViewController @property (strong) NSMu
.h
和.m
DerbyProTableViewController.h:
#import <UIKit/UIKit.h>
@interface DerbyProTableViewController : UITableViewController
@property (strong) NSMutableArray *racerarray;
@end
我将继续我在你粘贴的代码中看到的内容。我不知道故事板中可能设置了什么,但是 没有为UITableView对象指定委托或数据源。UITableViewDelegate处理单元格选择。 设置委托后,请执行以下操作:
[self.tableview setDelegate:self];
然后,您需要实现:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
像这样:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[self performSegueWithIdentifier:@"whateveryoursegueiscalled" sender:thecellyoutapped];
}
阅读一下Apple的tableview编程指南。很可能您没有在情节提要的Identity inspector中添加类
在情节提要中选择您的视图,然后单击identity ispector。确保Class字段不为空调用
performsguewithidentifier
在哪里?我很乐意!一定要去阅读它的文档,因为它有丰富的功能可以从你的tableview中获得。这是不对的,如果你使用的是故事板和附加的选择序列,那么为什么你必须使用该代码进行导航。它应该自动从故事板工作
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[self performSegueWithIdentifier:@"whateveryoursegueiscalled" sender:thecellyoutapped];
}