【发布时间】:2016-07-15 04:38:38
【问题描述】:
我正在制作一个表格视图,用户可以按下它并从按下的单元格中获取更多详细信息。但是,我在如何让 UIimage 工作时遇到了一些麻烦。
我的代码如下:
let shotMatchSegue = "ShowMatchSegue"
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == shotMatchSegue,
let destination = segue.destinationViewController as? MatchViewController,
matchIndex = recentMatchesTableView.indexPathForSelectedRow?.row
{
destination.matchChampionImage = UIImage(named: "\(championsPlayed[matchIndex])_Splash_Tile_0")
destination.matchType = gameType[matchIndex]
}
}
在我的 MatchViewController 上,我有以下内容:
@IBOutlet 弱变量 gameMatchChampionIcon: UIImageView!
@IBOutlet weak var gameMatchType: UILabel!
var matchType = String()
var championIcon = String()
override func viewWillAppear(animated: Bool) {
gameMatchChampionIcon.image = UIImage()
gameMatchType.text = matchType
}
我可以想象很可能是我设置了我的 gameMatchChampionIcon.image = UIImage() 错误。所以我想知道如果我想将图像传递给 UIimage,正确的设置方法是什么
感谢您的帮助!
【问题讨论】:
标签: swift2 uiimage segue tableviewcell