- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我有一个带有 menu 的默认主从 TableView .菜单有效,但由于某种原因,我在按“+”按钮在我的应用程序中添加另一个单元格时收到以下错误:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unable to dequeue a cell with identifier Cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
我搜索了好几天的解决方案
如果我添加到viewDidLoad
:
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:cellIdentifier];
我没有收到错误,但添加的单元格不是我的 Storyboard 中配置的单元格,也没有指向详细 View Controller 。
我多次检查了原型(prototype)单元格的标识符字段是否已填写并且与*cellIdentifier 相同。
据我所知,这似乎与问题的性质相同here .
如有任何帮助,我们将不胜感激,如果您有时间,请解释为什么我所做的是错误的,或者为什么应该添加某些代码。
请求代码(都是Xcode 5.0.1添加的默认代码):
// Code to add the button
UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(insertNewObject:)];
self.navigationItem.rightBarButtonItem = addButton;
// Code called when button is pressed:
- (void)insertNewObject:(id)sender
{
if (!_objects) {
_objects = [[NSMutableArray alloc] init];
}
[_objects insertObject:[NSDate date] atIndex:0];
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
[self.tableView insertRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];
NSDate *object = _objects[indexPath.row];
cell.textLabel.text = [object description];
return cell;
}
另请查看评论中添加的图片和项目文件
最佳答案
替换[MAAppDelegate application:didFinishLaunching]
中的以下行
UINavigationController *masterViewController = [[UINavigationController alloc] initWithRootViewController:[MAMasterViewController new]];
与
UINavigationController *masterViewController = (UINavigationController *)self.window.rootViewController;
当应用程序到达 didFinishLaunching
时, Root View Controller 已经从 Storyboard 中进行了配置(如果您查看您的 Storyboard , Root View Controller 就是箭头指向它的那个)。请注意,此过程依赖于 initWithCoder:
初始化程序。
在 didFinishLaunching
中,您将丢弃此 View Controller ,将其替换为 TWTSideMenuViewController
的实例,您已使用 的新的 Non-Storyboard 实例对其进行配置>UINavigationController
和 MAMasterViewController
。如果您考虑一下,[MAMasterViewController new]
无法知道它应该从特定的 Storyboard 元素进行配置。实际上有一个用于从 Storyboard实例化 View Controller 的 API:[storyboard instantiateViewControllerWithIdentifier:]
。但您不需要这样做,因为它已经为您完成了。
所以解决方法很简单。只需使用现有的 Root View Controller self.window.rootViewController
配置 TWTSideMenuViewController
。
关于ios - 必须为标识符注册一个 nib 或一个类或连接一个原型(prototype)单元,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19883009/
我有一个问题,想知道如何在已经使用常规登录/注册系统的网站上集成第 3 方登录(也进行静默注册)。 基本上当前登录还是比较规律的: 当用户进入网站 session 时类(class)决定他是否需要重新
我在学习 Hyperledger Fabric 并运行示例代码。 我仍在尝试正确了解事情的运作方式,尤其是在使用证书和加密 Material 的用户/管理员注册和注册中。 我想知道以下如何工作。 1)
我正在尝试使用从我的 Android 设备的 PassWallet 应用程序中保存的票证中获取的 token 向我的设备发送消息。 设备发送使用苹果钱包规范更新通行证所需的所有信息。但是,我正在使用
使用 Passport 本地示例,我可以登录工作。没有关于如何注册用户的文档。 我想为用户提供一个“电子邮件”和“密码”字段,他们可以使用它们来注册该网站。我怎样才能做到这一点?有什么原因没有记录下来
在之前的一些 WSO2IS 版本中,有一个默认的 self 注册功能。但是,我在 5.0 版本中找不到它。 阅读 WSO2IS 5.0 文档,我发现有 2 个用于此功能的 API: getUserId
我已将 Airship SDK 集成到 Android 应用程序中。在应用程序启动和飞艇起飞后,我在日志中得到以下调试信息: 07-27 12:46:31.916 XXX - UALib( 1545)
Delphi 中设计时包的可怕错误之一是以下错误,这意味着注册安装新组件到您的 Palette 上的包: Component TSomething can't be registered by pac
我发现的大部分内容都使用 php 或类似的东西。 我有一个 Angular 前端和 Node/express 服务器代码。还没有后端。我不确定如何继续用户注册。 最佳答案 在没有后端的情况下进行注册等
我正在使用 Drupal 6 开发一个网站。我正在使用我自己的主题,并且一切正常。现在我需要使用我的自定义主题在我的网站上创建一个自定义登录/注册表单。我尝试了很多方法,但一切都重定向到我的管理主题,
我在运行此代码时收到 Sip 异常。这是因为 manager.register(me,20,listener)。 下面是我的代码,所以请帮我更正这段代码。我正在使用 SipDemo 代码注册我的帐户。
在过去的几天里,我一直在尝试为基于 VUE 的 excel 制作任务 Pane 插件。 我已按照 link 的指南进行操作我试图为 onSelectionChange 注册一个事件处理程序。它已经有些
我需要在使用 django-registration 应用程序的登录表单中实现一个“记住我”按钮。任何ane可以帮助我向我展示这样做的方法吗? 谢谢 最佳答案 一种方法是更改 session 到期
我发现,如果您使用 Django 1.5 版本,则 django 注册模块会中断,因为在最新的 django 开发版本中,simple.py 类已被删除。 最佳答案 此问题现已修复: hg clone
我正在尝试将 facebook connect 实现到我的网站,但有几个问题。 1:是否可以使用用户当前的 Facebook 电子邮件/密码在我的网站上注册用户。 假设用户点击链接通过 faceboo
我使用 Facebook 注册来允许人们在我的网站上注册。有没有可能,在注册后,他在我的网站注册的成员(member)墙上会张贴? 最佳答案 这可能不是您正在寻找的答案,但我强烈建议您不要这样做。用户
I would like to use a slash (/) for a search during a vimscript, but I don't want to overwrite the "
我正在使用 jqgrid 并且有显示日期的列,但是来自服务器的日期以 json 格式出现,如下所示, "CommentedDate": "\/Date(1304324941000+0530)\/" 如
我希望用户可以直接登录主页,而不是在“../account/login/”页面上登录。我应该做什么才能使它成为可能?如何将主页上的输入字段与 allauth 连接?我不知道这样是否太复杂而无法以这种方
This question already has answers here: Understanding NSString comparison (7个答案) 5年前关闭。 我正在尝试制作注册表。有
我正在使用 Django 注册。它提供了处理 registration_form.html 的 View ,该 html 当前包含用户名、密码 1、密码 2 和电子邮件作为我的应用程序中的用户可输入字
我是一名优秀的程序员,十分优秀!