【发布时间】:2015-12-03 11:29:29
【问题描述】:
我是 ios 开发的新手,我只是在学习带有自定义表格单元格的表格视图,我使用故事板制作 ui 元素,对于自定义单元格我已经制作了一个 xib 文件,我已经参考了。Custom tableview i ios
我已经走了每一步,但我不知道缺少什么,我收到以下错误。
2015-12-03 16:52:48.336 MyFirstApp[4997:176795] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<netcluesvideosViewController 0x7a05a6b0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key nameLabel.'
我正在发布我的代码,请帮助,
net.h
进口
@interface netcluesvideosViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>
{
NSArray *tabledata;
IBOutlet UITableView *tableView;
}
@end
net.m
.
.
.
.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"NetCell";
NetCell *cell = (NetCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"NetCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
}
.
.
.
.
NetCell 是我的自定义单元类。
【问题讨论】:
-
发布您的故事板的屏幕截图以及您为什么要创建 .xib 文件。标准做法是现在在情节提要中创建 UI。试试这些教程-appcoda.com/ios-programming-customize-uitableview-storyboard
-
您之前在
netcluesvideosViewController中有一个变量名称nameLabel。打开netcluesvideosViewController(StoryBoard 或 Xib),并检查其插座。删除名为nameLabel的那个。 -
@natasha-感谢您的回复,但我刚开始学习,我真的不知道什么是仪式和什么是错的..!!!
-
@Larme-谢谢,让我试试。
-
只需在 xcode 中的 Find navigatior 上搜索“nameLabel”,您就可以看到您在项目中使用它的位置。
标签: ios objective-c iphone xcode uitableview