Xcode错误:插座无法连接到重复内容 [英] Xcode Error: Outlets cannot be connected to repeating content

查看:110
本文介绍了Xcode错误:插座无法连接到重复内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

经过一些搜索和编辑后,我似乎找不到解决此错误的解决方案.我正在尝试将位置搜索结果与表格链接,以列表形式显示搜索结果.

After doing some searching and editing, I can't seem to find a solution to fixing this error. I'm trying to link my location search results with a table to display the search results in a list-form.

我的地图带有详细信息"按钮,该按钮与名为"FirstViewController"的UIViewController链接.我的结果表与名为"ResultsTableViewController"的UITableViewController链接.我的原型单元与一个名为"ResultsTableCell"的UITableViewCell链接,这也是我的出口所在.

I have my map with the details button linked with a UIViewController called 'FirstViewController.' My results table is linked with a UITableViewController called 'ResultsTableViewController.' My prototype cells are linked with a UITableViewCell called 'ResultsTableCell' which is also where my outlets are located.

这是2个单独的错误:

非法配置:从ResultsTableViewController到UILabel的nameLabel出口无效.插座无法连接到重复内容.

Illegal Configuration: The nameLabel outlet from the ResultsTableViewController to the UILabel is invalid. Outlets cannot be connected to repeating content.

非法配置:从ResultsTableViewController到UILabel的phoneLabel插座无效.插座无法连接到重复内容.

Illegal Configuration: The phoneLabel outlet from the ResultsTableViewController to the UILabel is invalid. Outlets cannot be connected to repeating content.

我已经阅读了相同问题的其他人的帖子,试图进行相应的修复,但我仍然遇到相同的错误.

I've read other people's posts with the same problem, tried to fix them accordingly and I'm still getting the same error.

这是填充单元格的代码,位于我的ResultsTableViewController中.

Here is the code for populating the cell, located in my ResultsTableViewController.

let cell = tableView.dequeueReusableCellWithIdentifier("resultCell", forIndexPath: indexPath) as! ResultsTableCell

    // Configure the cell...
    let row = indexPath.row
    let item = mapItems[row]
    cell.nameLabel.text = item.name
    cell.phoneLabel.text = item.phoneNumber
    return cell
}

ResultsTableCell类中的代码:

The code in my ResultsTableCell class:

import UIKit

class ResultsTableCell: UITableViewCell {
    @IBOutlet weak var nameLabel: UILabel!
    @IBOutlet weak var phoneLabel: UILabel!
}

推荐答案

仅当您将其连接到视图控制器时,才会出现此消息.正如我已经评论过的那样,您可能没有删除与视图控制器建立的第一个连接插座.即使从视图控制器中删除了IBOutlet代码,您仍然需要右键单击它并删除可能仍然存在的旧连接.删除后,错误消息将消失.

This message only occurs if you connect it to the view controller. As I have already commented, you probably did not delete the first connection outlet you've made to your view controller. Even if you delete the IBOutlet code from your view controller you still need to right click it and delete the old connection that probably still there. After deleting it the error message will go away.

这篇关于Xcode错误:插座无法连接到重复内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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