Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

拖动ScrollView顶部的菜单栏的指示器不会移动 #5

Open
zhixinpeng opened this issue Mar 28, 2021 · 1 comment
Open

拖动ScrollView顶部的菜单栏的指示器不会移动 #5

zhixinpeng opened this issue Mar 28, 2021 · 1 comment

Comments

@zhixinpeng
Copy link

在完成Lesson7实现@binding@State的联动之后,拖动ScrollView发现菜单指示器由0变为1之后就不再变化。
但点击推荐、热门是可以的。
请问该如何解决这个问题,或者怎么定位到问题出现在哪里?

@Zakeiswo
Copy link

我发现在Coordinator的构造函数里parent根本没有刷新,但是HScrollViewController进行了三次初始化,第一次初始化的时候就给parent.pagewidth原来的值赋值为0.0了,而后面再次初始化的时候Coordinator的对象已经建立不会改变了,而且同时makeUIViewController也是只调用了一次,后面可以通过改变parent的类型变成var变量,然后在updateUIViewController里加上context.coordinator.parent = self重新告诉它parent是谁,就可以解决

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants