在做了一些搜索和编辑之后,我似乎无法找到修复此错误的解决方案.我正在尝试将我的位置搜索结果与表格链接,以便以列表形式显示搜索结果.
我的地图上有详细信息按钮,链接到名为'FirstViewController'的UIViewController.我的结果表与一个名为'ResultsTableViewController'的UITableViewController链接.我的原型单元与名为'ResultsTableCell'的UITableViewCell链接,这也是我的网点所在的位置.
以下是两个单独的错误:
非法配置:ResultsTableViewController到UILabel的nameLabel出口无效.插座无法连接到重复内容.
非法配置:ResultsTableViewController到UILabel的phoneLabel出口无效.插座无法连接到重复内容.
我已经阅读了同样问题的其他人的帖子,试图相应地修复它们,我仍然得到同样的错误.
以下是填充单元格的代码,位于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
}
Run Code Online (Sandbox Code Playgroud)
我的ResultsTableCell类中的代码:
import UIKit
class ResultsTableCell: UITableViewCell {
@IBOutlet weak var nameLabel: UILabel!
@IBOutlet weak var phoneLabel: UILabel!
}
Run Code Online (Sandbox Code Playgroud) 我的应用程序目前有一个本地搜索,可以为搜索结果添加注释.我想设置它,当您选择注释并单击调出按钮时,它将在地图应用程序中打开,其中包含指向当前设备位置注释的说明.我遇到了一些问题.
首先,我的注释按钮没有出现.其次,我认为我没有正确检测选定的注释.
这是我的搜索和选择注释的代码:
func performSearch() {
matchingItems.removeAll()
let request = MKLocalSearchRequest()
request.naturalLanguageQuery = searchText.text
request.region = mapView.region
let search = MKLocalSearch(request: request)
search.startWithCompletionHandler({(response:
MKLocalSearchResponse!,
error: NSError!) in
if error != nil {
println("Error occured in search: \(error.localizedDescription)")
} else if response.mapItems.count == 0 {
println("No matches found")
} else {
println("Matches found")
for item in response.mapItems as! [MKMapItem] {
println("Name = \(item.name)")
println("Phone = \(item.phoneNumber)")
self.matchingItems.append(item as MKMapItem)
println("Matching items = \(self.matchingItems.count)")
var annotation = MKPointAnnotation()
var coordinates = annotation.coordinate …Run Code Online (Sandbox Code Playgroud)