我得到以下代码:
var languageString: String = "" {
didSet {
if(languageString != oldValue) {
configureView()
}
if let popoverController = languagePopoverController {
popoverController.dismissPopoverAnimated(true)
languagePopoverController = nil
}
}
}
显示的错误是:
计算属性必须具有显式类型
我不明白这个错误。我是初学者。有什么帮助吗?
编辑:更多代码
@IBOutlet weak var detailDescriptionLabel: UILabel!
@IBOutlet weak var webView: UIWebView!
private var languageButton: UIBarButtonItem?
private var languagePopoverController: UIPopoverController?
声明很简单,其余代码在 tableView 上,但没有给出任何错误,只是字符串
编辑 2:更多代码
func configureView() {
//update the interface for details on the item
if let detail: AnyObject = self.detailItem {
if let label = self.detailDescriptionLabel {
let dict = detail as [String: String]
//let urlString = dict["url"]!
let urlString = modifyUrlForLanguage(url: dict["url"]!, language: languageString)
//detailDescriptionLabel.text = urlString
label.text = urlString
let url = NSURL(string: urlString)!
let request = NSURLRequest(URL: url)
webView.loadRequest(request)
let name = dict["name"]!
title = name
}
}
}
这是配置视图。也许它有帮助。