scrollsToTop不工作 [英] scrollsToTop not working

查看:154
本文介绍了scrollsToTop不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下对象结构:




  • UITabBarController


    • UINavigationController


      • UITableViewController





它以前工作,但是我添加了UITabBarController到混合,并做了一堆其他大的变化,它之间的某处停止。



到目前为止我有:




  • 用这个结构创建了一个新项目

  • 尝试在UITabBarController下直接添加新的UITableViewController ...仍然无法正常工作。



可能有用的一件事是 -scrollViewShouldScrollToTop: isn即使将表视图控制器的 tableView.delegate 设置为控制器,也不会被调用。



如果像我一样,你从苹果提供的标签栏模板开始,那么你必须添加以下行到applicationDidFinishLaunching:在您的应用程序委托:

  [window makeKeyAndVisible]; 

这一行是为我固定的。


I have the following object structure:

  • UITabBarController
    • UINavigationController
      • UITableViewController

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆