gpt4 book ai didi

ios - UITableView 标题不听滚动

转载 作者:行者123 更新时间:2023-11-29 03:06:45 24 4
gpt4 key购买 nike

我有一个简单的 UITable,我想要在表格开始前放一张小图片,所以到目前为止,我使用的表格标题非常好,效果很好

self.table.tableHeaderView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:img]];

唯一奇怪的是,当我尝试在表格 View 行上滚动时,表格会滚动,但是当我尝试在标题上滚动时,什么也没有发生,就像滚动监听器没有监听标题上的滚动事件。

需要明确的是,当您将表格整体滚动时,标题确实会滚动(这是所需的行为)

我疯狂地用谷歌搜索,但康德似乎找到了答案,谢谢!!

一些额外的代码

- (void)viewDidLoad
{

[super viewDidLoad];
// set the table header
self.table.tableHeaderView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"header"]];

// add empty footer view to hide empty cells
self.table.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];



// set title
self.navigationItem.title = [self.catData objectForKey:@"titlePage"] ? [self.catData objectForKey:@"titlePage"] : [self.catData objectForKey:@"title"];



}

最佳答案

使用分组 TableView 。然后你可以滚动你的表格 View 。

关于ios - UITableView 标题不听滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22683365/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com