gpt4 book ai didi

ios - 从 UITableViewController 切换到具有单独 UITableView 的 UIViewController 后,UITableView 委托(delegate)无法识别

转载 作者:行者123 更新时间:2023-11-29 03:26:38 24 4
gpt4 key购买 nike

我的问题是,到目前为止我使用的是 ViewController并在其中创建 UITableView以编程方式。为此ViewController我创建了一个名为 WalkTroughViewController 的类并将其设置在 Custom Class 内里面Identity Inspector .

现在我已经改变了,我创建了另一个 ViewController (删除旧的)并拖动 TableView来自 Object Library 。然后我设置了Custom Class这个新的ViewControllerWalkTroughViewController ,但现在当我运行该项目时我的 UITableView不召集代表。

我还拖了一个UITableViewCell里面UITableView并将其设置为我的自定义单元格类。

有什么指示我做错了什么吗?

编辑:

@interface WalktroughScreenViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>

- (IBAction)nextScreen;
@property (weak, nonatomic) IBOutlet UIButton *button;
@property (strong, nonatomic) IBOutlet UITableView *tableView;

@end

最佳答案

您可以将 Storyboard中表的委托(delegate)和数据源拖放到 fileOwner(您的 Controller )

或者简单地在ViewDidLoad方法中以编程方式分配它

self.tableView.delegate = self;
self.tableView.dataSource = self;

关于ios - 从 UITableViewController 切换到具有单独 UITableView 的 UIViewController 后,UITableView 委托(delegate)无法识别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20385240/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com