ios - Image is not being set to the nest UIViewController at the UIImageView -


i having problem swift.

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"  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 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")      }   }  */    override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?) {       if segue.identifier == "starbucksrefresherstoimageviewsegue" { // set in interface builder           let detailviewcontroller = segue.destinationviewcontroller refreshersimageview          if self.refresherdrink == "cool lime starbucks refreshers" {              detailviewcontroller.image = uiimage(contentsoffile: "coollime.png")          }          if self.refresherdrink == "valencia orange starbucks refreshers" {               detailviewcontroller.image = uiimage(contentsoffile: "valenciaorange.png")          }      }   } } 

in line

detailviewcontroller.image = uiimage(contentsoffile: "coollime.png") 

i want set next view controller's image view .png file want display. when navigate view controller image should displayed, there no image , getting no errors @ all. here other view controller image should displayed;

import foundation import uikit  class refreshersimageview: uiviewcontroller {  @iboutlet weak var refreshersimageview: uiimageview! var refresherdrink = "blahblah" var image: uiimage?  override func viewdidload() {     super.viewdidload()      image = refreshersimageview.image } } 

it frustrating , tried of stack overflow results nın ıf them worked. please help!

in refreshersimageview

change:

image = refreshersimageview.image 

for:

refreshersimageview.image = image 

also:

  • it's bad practice call uiviewcontroller refreshersimageview. gives impression it's widget, not full-blown view controller.
  • as @woodstock states, check images selected in target , copied app's bundle.
  • check image name capitalization

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -