scrollsToTop不工作 [英] scrollsToTop not working
问题描述
我有以下对象结构:
- UITabBarController
- UINavigationController
- UITableViewController
- UINavigationController
它以前工作,但是我添加了UITabBarController到混合,并做了一堆其他大的变化,它之间的某处停止。
到目前为止我有:
- 用这个结构创建了一个新项目
- 尝试在UITabBarController下直接添加新的UITableViewController ...仍然无法正常工作。
可能有用的一件事是 -scrollViewShouldScrollToTop:
isn即使将表视图控制器的 tableView.delegate
设置为控制器,也不会被调用。
如果像我一样,你从苹果提供的标签栏模板开始,那么你必须添加以下行到applicationDidFinishLaunching:在您的应用程序委托:
[window makeKeyAndVisible];
这一行是为我固定的。
I have the following object structure:
- UITabBarController
- UINavigationController
- UITableViewController
- UINavigationController
It used to work, but then I added the UITabBarController into the mix and made a bunch of other large changes and somewhere in between it stopped.
So far I have:
- created a new project with that structure, and that seems to work OK.
- checked that there's only one view with scrollsToTop
- tried adding a new UITableViewController directly under UITabBarController... still doesn't work.
One thing that might be of use is that -scrollViewShouldScrollToTop:
isn't even being called, even though the table view controller's tableView.delegate
is set to the controller.
Just came across this problem myself.
If, like me, you started from the tab bar template Apple provides, then you have to add the following line to applicationDidFinishLaunching: in your app delegate:
[window makeKeyAndVisible];
This one line is what fixed it for me.
这篇关于scrollsToTop不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!