iOS7 UITableView scrollsToTop不';行不通
“我的视图”控制器中只有一个UITableView,下面是我的代码:iOS7 UITableView scrollsToTop不';行不通,ios,uitableview,uiscrollview,Ios,Uitableview,Uiscrollview,“我的视图”控制器中只有一个UITableView,下面是我的代码: @interface MyViewController ()<UITableViewDataSource,UITableViewDelegate> self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, [UIScreen mainScreen].bounds.size.height) style:UITabl
@interface MyViewController ()<UITableViewDataSource,UITableViewDelegate>
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, [UIScreen mainScreen].bounds.size.height) style:UITableViewStylePlain];
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.scrollsToTop = YES;
[self.view addSubview:self.tableView];
我不知道为什么,我怎样才能解决这个问题?非常感谢。ScrollStop不是UITableViewDelegate/UITableViewDatasource的方法。
尝试将UIScrollDelegate添加到MyViewController界面。ScrollStop不是UITableViewDelegate/UITableViewDatasource的方法。
尝试将UIScrollDelegate添加到MyViewController界面。您可能会忘记使用ScrollView委派
@interface MyViewController ()<UITableViewDataSource,UITableViewDelegate,UIScrollViewDelegate>
instead of
@interface MyViewController ()<UITableViewDataSource,UITableViewDelegate>
@接口MyViewController()
而不是
@接口MyViewController()
您可能会忘记接受ScrollView委托
@interface MyViewController ()<UITableViewDataSource,UITableViewDelegate,UIScrollViewDelegate>
instead of
@interface MyViewController ()<UITableViewDataSource,UITableViewDelegate>
@接口MyViewController()
而不是
@接口MyViewController()
屏幕上是否有多个scrollview、tableview或collectionview
如果是这样,则只有其中一个可以将ScrollStop设置为YES,否则iOS7将不会将其中任何一个滚动到顶部
正如苹果的文档所说,“在iPhone上,如果屏幕上有多个滚动视图将scrollsToTop设置为YES,则滚动到顶部的手势无效。”
来自的参考屏幕上是否有多个scrollview、tableview或collectionview 如果是这样,则只有其中一个可以将ScrollStop设置为YES,否则iOS7将不会将其中任何一个滚动到顶部 正如苹果的文档所说,“在iPhone上,如果屏幕上有多个滚动视图将scrollsToTop设置为YES,则滚动到顶部的手势无效。”
来自的参考屏幕上还有其他滚动视图(或滚动视图子类,如表视图或集合视图)吗?@Virussmca感谢您的回复,我正在使用第三部分库,在我的TableView后面还有另一个uitableView。正如苹果的文档所说,“在iPhone上,如果屏幕上有多个滚动视图将scrollsToTop设置为“是”,则滚动到顶部手势无效。”@Virussmca好的,我明白了!请留下答案,我将投票表决。是否还有其他滚动视图(或滚动视图子类,如表视图或集合视图)在屏幕上?@Virussmca感谢您的回复,我正在使用第三部分库,在我的TableView后面还有另一个uitableView。正如苹果的文档所说,“在iPhone上,如果屏幕上有多个scroll view将scrollsToTop设置为YES,则scroll to top手势无效。“@Virussmca好的,我明白了!请留下答案,我将投票表决。