Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why the animation of push another view controller goes not smooth?

I got a table View and collection view on the each cell.
When I tapped the cell, following code will be invoked in cell's didSelectRowAt:IndexPath method.

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {

        navigationController?.pushViewController(anotherViewController(), animated: true)

    }

The anotherViewController is an empty view controller on storyboard for now. It only print "I'm coming" in viewDidLoad().
Here is the problem: When I touched the cell, the push animation seems got stuck, pleas check the following GIF.
I'm really confused in what's happend.
Feel free to give any Advice.

The following Image shows the view hierarchy.
Cells on the table view.
Collection view and other components on the cell's content view.
At the end, image views on the collection view's content view.

View Hierarchy

like image 635
JsW Avatar asked Sep 14 '25 07:09

JsW


1 Answers

The solution for me was to explicitly set the background color of the new view controller, even if it's black. I had the same issue and since I'm not using storyboard, this was the solution for me.

like image 129
AW5 Avatar answered Sep 15 '25 23:09

AW5