(swift2) 变量在 if 语句中没有变化



我面临的问题 ishat 我无法更新变量 lin。我已经尝试了多个 f:(。要快速进入代码中的第 2 行,该代码是标识变量的位置,然后如果您滚动到代码底部,则变量应该更改但不

更改
let menable = UITabletgView()
let arfSorces:[String] = ["C"]


public func runMenu(){
if let window = UIApplication.sharedApplication().keyWindow{
dimming.frame = window.frame
dimming.backgroundColor = UIColor(white: 0.9, alpha: 0.5087)
dimming.addGestureRecognizer(UITapGestureRecognizer(target: self, action: Selector("eefefef")))
let height: CGFloat = 100000
let y = window.frame.height - height + height
menuTable.frame = CGRect(x: 10, y: window.frame.height, width: window.frame.height, height: height)
window.addSubview(dimming)
window.addSubview(mee)
eView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("c", forIndexPath: indexPath)as UITableViewCell
e.textLabel?.text = ars[indexPath.item]
return e
}
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
return 50000
}
func tableView(tableView: UITableView, didDeselectRowAtIndexPath indexPath: NSIndexPath) {
func RunLink(){
if let v = c{
98bdfe8daf6543d92"

在 if 语句中,你声明了一个全新的变量 link1,它只存在于该 if 语句中。改变

if arrayOfSorces[indexPath.item] == arrayOfSorces[0]{
var link1 = "https://newsapi.org/v2/everything?sources=bbc-news&apiKey=a9ea5ee627044bd98bdfe8daf6543d92"
RunLink()
}

if arrayOfSorces[indexPath.item] == arrayOfSorces[0]{
link1 = "https://newsapi.org/v2/everything?sources=bbc-news&apiKey=a9ea5ee627044bd98bdfe8daf6543d92"
RunLink()
}

(摆脱var。这将创建一个新变量,而不是更改现有变量中的值。

最新更新