我試圖在兩個視圖控制器之間進行自定義轉換。首先,這裏的圖片說明我想要的東西:「魔法移動」效果自定義轉換
我想UICollectionViewCell擴展到整個屏幕。在這個單元格中,子視圖與Autolayout放在IB中。
我只是想讓每個子視圖都轉到新的位置。所以我試圖在動畫塊中嘗試subview.frame = newSubview.frame
,但它不起作用(因爲我認爲Autolayout)。
我想在動畫發生時刪除約束,但它不起作用。
我也試着讓@IBOutlets的約束和改變常量屬性。
這裏是我的代碼:
let detailView = detailViewController.view
let cellView = self.selectedCell
container.addSubview(cellView!)
let duration = self.transitionDuration(transitionContext)
UIView.animateWithDuration(duration, delay: 0.0, options: .CurveEaseInOut, animations: {
let newFrame = detailViewController.view.frame
cellView!.frame = newFrame
cellView!.imageView.frame = newFrame
cellView!.labelTopConstraint.constant = 27
cellView!.labelRightConstraint.constant = 8
cellView!.layoutIfNeeded()
}
...
實際上,當動畫開始標籤捕捉到的位置,然後他們移動,並在年底他們不是在正確的位置...
任何想法?由於
您是否找到適合您問題的酷解決方案? – mikrobi 2015-04-23 09:13:29