我有类API代码
import Foundation
import UIKit
class GalleryModel {
var logoImage : UIImage!
var galleryImages: [UIImage]!
var title = ""
init ( title: String, logoImage: UIImage, galleryImages: [UIImage] ) {
self.title = title
self.logoImage = logoImage
self.galleryImages = galleryImages
}
static func createGalleryImages () -> [GalleryModel] {
return [
GalleryModel(title: "Saturday Night @ STODOLA PUB" , logoImage: UIImage(named: "g1.0")!, galleryImages: [UIImage(named: "g1.1")!,
UIImage(named: "g2.1")!,
UIImage(named: "g3.1")!,
UIImage(named: "g4.1")!,
UIImage(named: "g5.1")!,
UIImage(named: "g6.1")!,
UIImage(named: "g7.1")!,
UIImage(named: "g8.1")!,
UIImage(named: "g9.1")!,
UIImage(named: "g10.1")!,
UIImage(named: "g11.1")!,
UIImage(named: "g12.1")!,
UIImage(named: "g13.1")!,
UIImage(named: "g14.1")!,
UIImage(named: "g15.1")!,
UIImage(named: "g16.1")!,
UIImage(named: "g17.1")!,
UIImage(named: "g18.1")!,
UIImage(named: "g19.1")!,
UIImage(named: "g20.1")!]),
所以我可以提供一个这个图像的数组:
class FotoCell: UICollectionViewCell {
var infoFoto: GalleryModel! {
didSet{
updateFoto ()
}
}
@IBOutlet weak var FotoGalleryImage: UIImageView!
func updateFoto () {
// Here problem like : NSArray in to subtype of UIImage
FotoGalleryImage?.image = infoFoto.galleryImages
}
}
我制作了相册(但只有外观)。我希望当我点击图像相册时,我打开了包含许多照片的窗口。我从图像中花了IBoutlet。我想在此图片中添加数组图片。但问题是她:FotoGalleryImage?.image = infoFoto.galleryImages。添加了不是子类型UIImage的NSArrey。我该怎么改变一切都很好?