Swift To Group Images

时间:2016-10-28 13:58:14

标签: ios swift

我应该创建您在图像中看到的内容。我有一系列图像,我应该将它们分组。当我点击时应该打开一个包含所有图像的窗口。有没有人有任何想法?enter image description here

1 个答案:

答案 0 :(得分:1)

好吧,因为你不知道我会给一个简短的。您需要collectionView和2个不同的collectionViewCells

  1. 将用于显示图像的第一个收集单元格(包含UIImageView
  2. 第二个收集单元格将有一个UIImageView,在其上方是一个透明的UIView,黑色,并且在两者之上,中间应该有一个UILabel,显示照片的数量你没有表现出来。
  3. UIViewController应符合您需要处理此事件的UICollectionViewDelegate

    func collectionView(_ collectionView: UICollectionView,
                        didSelectItemAt indexPath: IndexPath) {
        // This is the last element where you show the second custom cell
        if indexPath.item == collectionView.numberOfItems(inSection: indexPath.section) - 1 {
            // Load all the items and pass it to the controller that you need to present
        }
    }
    

    现在好好实施它,因为它可以帮助你更好地理解事情的工作方式iOS