菜鸟教程小白 发表于 2022-12-11 18:35:38

ios - 为 TableView 部分 iOS 添加背景


                                            <p><p>我有一个包含动态多行的部分,我需要将所有部分与背景分开,如下图所示。</p>

<p>特别是所有部分的边界线。请让我知道我怎样才能使它成为可能。</p>

<pre><code>- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView;
{
    returnProductArray.count;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    NSArray *arr = ;
    return arr.count;   
}
</code></pre>

<p>请引用这里</p>

<p> <img src="/image/tkN7o.jpg" alt="image"/> .</p>

<p>我尝试添加页眉和页脚,但我不明白如何为整个部分添加矩形框图像。</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>在输出该 View 后将 View 放入您的单元格中。并使用 <strong>cellForRowAtIndexPath</strong> 这个方法。</p>

<pre><code>    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    TableViewCell *cell = ;
                ;

    cell.viewBackGround.backgroundColor = ;
    return cell;
}
</code></pre></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 为 TableView 部分 iOS 添加背景,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/45973228/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/45973228/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 为 TableView 部分 iOS 添加背景