线程1:EXC_BAD_INSTRUCTION(代码= EXC_1386_INVOP。子代码= 0x0)

时间:2015-04-28 18:18:53

标签: ios swift

我正在尝试根据用户的选择在另一个ViewController中更改UIIMageView。但我得到了恼人的错误!我错过了什么?

import UIKit

class StarbucksRefreshersBeverages:UIViewController,UITableViewDelegate {

@IBAction func doneButtonPressed(sender: AnyObject) {

    self.dismissViewControllerAnimated(true, completion: nil)

}
var drink = "blah"

var refreshersDrinks = ["Cool Lime Starbucks Refreshers", "Valencia Orange Starbucks Refreshers", "Verry Berry Hibiscus Starbucks Refreshers"]

var refresherDrink = "blahblah"


override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}


func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

    return refreshersDrinks.count

}



func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

    var cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "starbucksRefreshersPrototypeCell")

    cell.textLabel?.text = refreshersDrinks[indexPath.row]

    return cell


}


func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {


    self.refresherDrink = refreshersDrinks[indexPath.row]

    self.performSegueWithIdentifier("starbucksRefreshersToImageViewSegue", sender: self)



}

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {


    var detailViewController = segue.destinationViewController as RefreshersImageView

    detailViewController.refresherDrink = self.refresherDrink

    if self.refresherDrink == "Cool Lime Starbucks Refreshers" {

        detailViewController.refreshersImageView.image! == UIImage( contentsOfFile: "coolLime.png")!


    }

    if self.refresherDrink == "Valencia Orange Starbucks Refreshers" {


        detailViewController.refreshersImageView == UIImage(contentsOfFile: "valenciaOrange.png")

    }


}

}

我已经看了对方的问题但却什么都不懂:(请帮助我。顺便说一下,我对编程很新,我只有15岁)所以请在评论中理解,请按照我的方式回答能够理解。 非常感谢并提前感谢

0 个答案:

没有答案