ios - 将目标添加到另一个 View Controller 中的按钮
<p><p>为什么这不起作用?我希望新 ViewController 中的 closeBtn 在当前 ViewController 中调用一个名为 dismiss: 的方法。</p>
<pre><code>NewViewController *newVC = [ initWithNibName:@"NewViewController" bundle:];
;
</code></pre>
<p>dismiss: 方法永远不会在当前 ViewController 中调用。 closeBtn 已正确设置为 NewViewController 中的属性并链接到 .xib 文件中。</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>创建另一个 Controller 的对象并在 addTarget 中指定它。在 action 参数中给出方法的名称。
即另一个 Controller*obj;
;</p></p>
<p style="font-size: 20px;">关于ios - 将目标添加到另一个 ViewController 中的按钮,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/7828656/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/7828656/
</a>
</p>
页:
[1]