I want to achieve Fold animation when the user scrolls UICollectionView. I have UICollectionView with full-screen size cell and vertically scrolling with paging enabled. For that I've created sub-class of UICollectionViewFlowLayout which is as described below.
class FoldingFlowLayout: UICollectionViewFlowLayout {
private let logger = Logger(subsystem: bundleIdentifier, category: "FlowLayout")
override func prepare() {
super.prepare()
scrollDirection = .vertical
minimumLineSpacing = 0
minimumInteritemSpacing = 0
}
override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
let attributes = super.layoutAttributesForElements(in: rect)
attributes?.forEach { attribute in
transformLayoutAttributes(attribute)
}
return attributes
}
override func shouldInvalidateLayout(forBoundsChange newBounds: CGRect) -> Bool {
return true
}
private func transformLayoutAttributes(_ attributes: UICollectionViewLayoutAttributes) {
guard let collectionView = collectionView else { return }
let contentOffsetY = collectionView.contentOffset.y
let cellOffsetY = attributes.frame.origin.y - contentOffsetY
let cellHeight = attributes.frame.height
var transform = CATransform3DIdentity
transform.m34 = -1.0 / 500.0 // Apply perspective
if cellOffsetY < cellHeight && cellOffsetY > -cellHeight {
let angle = (cellOffsetY / cellHeight) * .pi / 2
transform = CATransform3DRotate(transform, angle, -1, 0, 0)
attributes.transform3D = transform
attributes.alpha = 1.0 - (abs(cellOffsetY) / cellHeight)
} else {
attributes.transform3D = CATransform3DIdentity
attributes.alpha = 1.0
}
}
}
But this is not working as I expected. I want to create replica of this kind of animation.
What am I missing here?
Post
Replies
Boosts
Views
Activity
I'm developing an app where the client wants to develop his app in Spanish only. But I can not understand Spanish, that's why my plan is if somehow I can change the default (Base) language to Spanish but I'll keep the development language as English.
How can I change the Base language to Spanish?
I want all users (who have set Spanish or then Spanish) in Spanish only. But Only if I run from my Xcode (e.g. Debug) then and only then English should appear.
I'm using the Xcode server which shipped with Xcode 12.4.
I'm setting Xcode-server's bot to generate an ad-hoc build from my source code. That IPA file is working perfectly on iOS 13. But when I try to install on iOS14+ device it is giving me error like "Unable to install app".
I read somewhere that from iOS14 TLS 1.2 is mandatory, which is not in Xcode 12.4's Xcode server or even Xcode 13's server.
Can we manually update SSL for the Xcode server which is running locally? What will be the steps?
Recently I've started to work with Xcode server and Xcode bot.
I'm just using Xcode 12.3, no OS X server application.
I've configured bot correctly which generates IPA file of my iOS application. But when I try to install that IPA with
https://my-macbook-air.local/xcode
It always shows me error in iOS 14+ device.
I've downloaded and installed profile and manually trust certificate from Settings. But no luck on iOS 14+.
Even thought same IPA is being installed in iOS 13.3 device.
I read somewhere that iOS 14 uses TLS 1.3 by default for all SSL certificates, is that related to my problem? Does my Xcode server's self signed SSL is not supporting TLS 1.3?
How can I solve this problem?