自从我搬到新的iOS9和Xcode 7后,我偶然发现了UICollectionView我的应用程序中的一个问题.
显然,UICollectionView似乎没有UICollectionViewCell正确地更新布局和约束,只有在它被重用之前.
图片说得比文字更好 - 这UIViewController是第一次看到时的样子:

然而,这不是正确的布局,当我UICollectionView向左水平滑动时,我得到了新出现的单元格的正确布局:

当我向后滑动时,旧的细胞不正确,现在重复使用并且看起来很好.
现在,就像升级到iOS9和Xcode 7之前一样,我想要的效果是即使首次出现,单元格也具有正确的布局.
为方便起见,以下是有关如何UICollectionView设置及其在XIB中的约束的更多详细信息:

在代码中,它非常标准:
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell : MatchmakersCollectionViewCell = collectionView.dequeueReusableCellWithReuseIdentifier("CollectionCell", forIndexPath: indexPath) as! MatchmakersCollectionViewCell
cell.imageView.backgroundColor = UIColor.lightGrayColor()
cell.bottomName.text = "StackOverflow"
return cell
}
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return self.matchmakers.count
}
func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
return 1
}
Run Code Online (Sandbox Code Playgroud)
每次我更新数据源(self.matchmakers)时,我都会打电话 self.collectionView.reloadData()
我注意到的最后一件事非常奇怪,当使用Xcode调试调试视图层次结构时,UICollectionViewCell从未正确显示子视图,只是给了我一个默认值UIView:

我使用转换委托创建了自定义动画转换:
vc.modalTransitionStyle = UIModalPresentationCustom;
vc.transitioningDelegate = self.transitioningDelegate;
Run Code Online (Sandbox Code Playgroud)
过渡代表工作得很好,但我试图达到迄今为止我没有成功的效果.我试图让新的视图控制器看起来像这样的效果:
我尝试过做CGAffineTransformMakeScale,但是它会缩放新的视图控制器视图,而不仅仅是"将视图圈扩展到它".当尝试使用动画更改边界和边框时,它总是最适合圆圈与屏幕边界,并且不会像我给出的动画那样完全打开圆圈.
有任何想法吗?
谢谢.