无法为表视图控制器(UITableViewController)选择自定义类 [英] Cannot select Custom Class for Table View Controller (UITableViewController)

查看:65
本文介绍了无法为表视图控制器(UITableViewController)选择自定义类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我以此开头,说我已经尝试过退出并重新启动Xcode,以及删除该项目的派生数据,无济于事.我现在机智.

Let me preface this by saying that I've already tried quitting and restarting Xcode, as well as deleting derived data for the project, to no avail. I'm at wits end right now.

基本上,我已经创建了一个想要使用的自定义ViewController类,但是无法选择它.实际上,使用自定义类"下拉列表,我只能为控制器选择默认的UITableViewController类.奇怪的是,看起来整个列表有时会瞬间显示,然后用单个选项替换为不正确的列表.看起来是这样的:

Basically, I've created a custom ViewController class I want to use, but I cannot select it. In fact, using the Custom Class dropdown, I can only select the default UITableViewController class for my controller. The weird part is, it looks like the full list appears for a split second sometimes, before being replaced by the incorrect list with a single option. Here's what it looks like:

我真的很感谢这里的任何想法.我不确定我会做错什么,因为我正在关注

I would really appreciate any ideas here. I'm not really sure what I could have done wrong, since I was following this Apple tutorial pretty much to the T.

对于项目中的另一个场景,它只是一个纯视图控制器,我可以毫无问题地选择自定义类.

For another scene in my project, which is just a plain view controller, I can select custom classes with no problems.

想法?

推荐答案

您必须从UITableViewController类继承,因此,基本上接口文件(.h)应该如下所示:

You have to inherit from UITableViewController class so basically the interface file (.h) should looks like that:

@interface YOURCLASSNAME : UITableViewController

请确保将您的类名替换为YOURCLASSNAME,并添加UITableViewController,这应该可以完成工作.

Make sure you replace YOURCLASSNAME with your class name and you add UITableViewController and that should do the job.

这篇关于无法为表视图控制器(UITableViewController)选择自定义类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆