SWIFT值..没有成员

时间:2017-03-07 20:18:09

标签: ios swift xcode8

我是swift的新手,正在寻找我正在努力编写的这个特殊功能的帮助。

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    if let identifier = segue.identifier {

        switch identifier {
            case "Show Album":

                let albumViewController = segue.destination as! AlbumViewController
                let albumImageView = (sender as AnyObject).view as! UIImageView
                if let index = index(of: covers, albumImageView) {
                    let album = Album(index: index)
                    albumViewController.album = album
                }

在线:

let albumImageView = (sender as AnyObject).view as! UIImageView

获取错误:

ambiguous use of 'view'

感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

sender as AnyObject强制sender输入AnyObjectAnyObject没有名称为view的属性,因此在其上调用.view没有意义。