gpt4 book ai didi

objective-c - 如何在界面生成器中添加将两个 slider 链接在一起的 "lock"按钮?

转载 作者:行者123 更新时间:2023-12-03 16:52:51 25 4
gpt4 key购买 nike

我想添加一个按钮,按下该按钮会将两个 slider 锁定在一起,以便两个 slider 的值始终相同。

我有一个使用代码的解决方案,但我想知道是否有一种方法可以单独使用界面生成器来完成此操作。

我担心基于代码的解决方案在高 CPU 使用率环境中一个 slider 可能落后于另一个 slider 。

最佳答案

不,仅使用 Interface Builder 无法做到这一点。

实际上一切最终都会变成代码,据我了解,Interface Builder 的构建是为了缩短开发时间,而不一定是为了提高性能,我在 Apple 网站上发现了关于 NIB 的有趣引用:

Xcode works in conjunction with these frameworks to help you connect the controls of your user interface to the objects in your project that respond to those controls.

考虑到这一点,一切都将成为代码(某种程度上)。 About NIB files .

At runtime, these descriptions are used to recreate the objects and their configuration inside your application. When you load a nib file at runtime, you get an exact replica of the objects that were in your Xcode document. The nib-loading code instantiates the objects, configures them, and reestablishes any inter-object connections that you created in your nib file.

如果您真的想避免这种行为,可能最好的办法就是从头开始创建小部件,但这将是一个完全不同的问题。

<罢工>只是好奇,为什么不想使用代码?

关于objective-c - 如何在界面生成器中添加将两个 slider 链接在一起的 "lock"按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9425341/

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