Core Animation

RSS for tag

Render, compose, and animate visual elements using Core Animation.

Posts under Core Animation tag

43 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Anime with TabView
In vision OS, the tab bar of TabView is outside the window by default. If I switch a page without TabView to a page that needs TabView in my program, the tab bar will suddenly appear on the left side of the screen without any animation. I hope it has an animation when it appears (such as easeIn, move). I tried it in Tab. Other animation-related modifiers such as animation are added under View, but there is no animation in the tab bar. Only the view in the tab has an animation effect, but this is not what I want. What I want is that the tab bar outside the window can have animation. What should I do?
1
0
237
2w
New iOS 18 UIView animation methods not available yet?
On the WWDC24 session video 'Enhance your UI animations and transitions', Appls shows these new animation methods for UIKIT: switch gesture.state { case .changed: UIView. animate(.interactiveSpring) { bead.center = gesture.translation } case .ended: UIView. animate(spring) { bead.center = endOfBracelet } } As of iOS 18 Beta 2, I get an error for `UIView. animate(.interactiveSpring)` These new methods are not available yet?
0
0
157
2w
Modifying the view hierarchy of a UITableViewCell as part of reloadData
I am trying to debug a crash due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSFrozenDictionary layoutSublayers]: unrecognized selector sent to instance. I see 2 things that I find interesting about it. The fact that the instance is a __NSFrozenDictionary tells me that the reference to a CALayer that has since been evicted from memory and re-written. The call to layoutSublayers tells me that the CALayer was dealloc-ed at some point between the call to setNeedsLayout (or layoutIfNeeded) This seemingly occurs as part of a call to -[UITableView reloadData] Furthermore, each cell created by the UITableView has a UIStackView. As part of the call to cellForRowAtIndexPath the code adds an instance of "custom view" to the stack view's subviews. As part of the call to prepareForReuse the code removes the "custom view" from the stack view's subviews. Therefore as part of the prepareForReuse the "custom view" (and its layer) is evicted from memory. My theory is that the tableview does a layout pass on the visible cell which has since had its subview removed which causes the crash. My question is what are the constraints on when/where to call reloadData and/or when/where you should definitely avoid it as it relates to this context? This is code that modifies the view hierarchy of the cell as part of its lifecycle which AFAIK this is "not supported" since prepareForReuse is meant to be used for resetting view state and cellForRowAtIndexPath to reset content. In that sense, another question, are you not allowed to modify the cell view hierarchy period as part of the cycle to draw the visible cells or is it more of a case, do not call reloadData?
2
0
173
1w