菜鸟教程小白 发表于 2022-12-12 23:34:01

ios - 从 UITableviewcell 移动到 ViewController 并使用 Storyboard返回


                                            <p><p>我有一个 ViewController ,里面有多个 tableviewcells。我想使用 Storyboard 从一个 tableviewcell 移动到另一个 viewcontroller。我有一个用于 ViewController 的导航 Controller 。我真的没有找到解决这个问题的方法。</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>你应该实现 <code>didSelectRowAtIndexPath</code> 委托(delegate),然后是一些用于移动到另一个 ViewController 的逻辑。</p>

<pre><code>@interface ViewController()&lt;UITableViewDelegate&gt;

...

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    AnotherViewControllerClass *vc = [ instantiateViewControllerWithIdentifier:@&#34;AnotherViewControllerIdentifier&#34;];

    ;
}
</code></pre></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 从 UITableviewcell 移动到 ViewController 并使用 Storyboard返回,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/41562075/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/41562075/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 从 UITableviewcell 移动到 ViewController 并使用 Storyboard返回