Как передать данные контроллеру вида, который имеет изображения внутри вида коллекции, другому контроллеру представления, при нажатии на изображение? Поэтому, когда я нажимаю изображение, он открывается в другом контроллере.Пропустить представление изображения из представления коллекции в новый контроллер представления
код cellForItemAtIndexPath:
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell
{
let cell = collectionView.dequeueReusableCellWithReuseIdentifier("cell", forIndexPath: indexPath) as! CollectionViewCell
cell.imageText.adjustsFontSizeToFitWidth = true
cell.layer.borderWidth = 0.5
cell.layer.cornerRadius = 3
let myColor : UIColor = UIColor(red: 0.0, green: 0.0, blue:0.0, alpha: 0.15)
cell.backgroundColor = UIColor(red: 0.0, green: 0.0, blue: 0.0, alpha: 0.025)
cell.layer.borderColor = myColor.CGColor
let post = self.arrayOfDetails[indexPath.row]
cell.currentUserLabel.text = post.username
cell.imageText.text = post.text
cell.uploadedTimeLabel.text = post.CreatedAt.timeAgo
cell.imageView.setImageWithUrl(NSURL(string: post.image)!, placeHolderImage: UIImage(named: "Placeholder"))
return cell
}
Детали: метод
struct Details {
var username:String!
var text:String!
var CreatedAt:NSDate!
var image:String!
init(username:String,text:String,CreatedAt:NSDate,image:String){
self.username = username
self.text = text
self.CreatedAt = CreatedAt
self.image = image
}
}
didSelectItemAtIndexPath:
func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath)
{
self.performSegueWithIdentifier("showImage", sender: self)
}
Любые предложения, пожалуйста?
где ваш метод didSelectItem? –