gpt4 book ai didi

iphone - 基于苹果示例代码 TVAnimationsGestures 在基于 UITableView 的 Accordion View 中一次保持一个部分打开

转载 作者:行者123 更新时间:2023-11-29 10:58:28 25 4
gpt4 key购买 nike

我正在构建一个带有基于 UITableView 的 Accordion View 的应用程序。此代码基于 Apple 示例代码,可以找到 herehere .在示例代码中,我试图解决的问题就在那里,所以我知道这不是我引入的。

如果您打开多个部分而没有明确关闭前一个部分,则可以同时打开多个部分。这可能会导致崩溃,可以通过点击按钮 1、2、3、1、1、3 来重现。

在我的应用程序中,我试图关闭上一节并且在打开新节时标题中的按钮进入未选中状态,这样您就只能打开一个节并选择一个节标题按钮一次。如果有人对此示例代码或 tableview 的使用有任何经验,我很乐意纠正这个问题,特别是因为这是 Apple 自己的代码中固有的问题

最佳答案

从未设置 APLSectionInfo 的属性 APLSectionHeaderView* headerView。所以在 tableView 委托(delegate)方法中设置 sectionInfo.headerView = sectionHeaderView

-(UIView*)tableView:(UITableView*)tableView viewForHeaderInSection:(NSInteger)section {

APLSectionHeaderView *sectionHeaderView = [self.tableView dequeueReusableHeaderFooterViewWithIdentifier:SectionHeaderViewIdentifier];

APLSectionInfo *sectionInfo = (self.sectionInfoArray)[section];

sectionHeaderView.titleLabel.text = sectionInfo.play.name;
sectionHeaderView.section = section;
sectionHeaderView.delegate = self;
sectionInfo.headerView = sectionHeaderView;
return sectionHeaderView;
}

关于iphone - 基于苹果示例代码 TVAnimationsGestures 在基于 UITableView 的 Accordion View 中一次保持一个部分打开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17186040/

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