菜鸟教程小白 发表于 2022-12-12 13:37:50

ios - willDisplayHeaderView 未在 TableViewController 中调用


                                            <p><p>为什么在 TableViewController 中没有调用 willDisplayHeaderView?</p>

<pre><code>- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(nonnull UIView *)view forSection:(NSInteger)section
{
//
}
</code></pre>

<hr/>

<p><strong><em>编辑:</em></strong> </p>

<p>和heightForHeaderInSection</p>

<pre><code>- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
//
}
</code></pre>

<hr/>

<p>弃用?</p>

<p>XCODE 版本 9.0 beta 5 (9M202q)</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>谢谢克鲁纳尔!您的评论针对 iOS 11 修复了它(早期的 iO​​S 版本没有任何问题)</p>

<pre><code>- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
return myView;
}
</code></pre></p>
                                   
                                                <p style="font-size: 20px;">关于ios - willDisplayHeaderView 未在 TableViewController 中调用,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/45737467/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/45737467/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - willDisplayHeaderView 未在 TableViewController 中调用