简体   繁体   English

FBTweakBind和FBTweakValue有什么区别?

[英]What's the difference between FBTweakBind and FBTweakValue?

I am using FBTweak lib in my iOS project. 我在我的iOS项目中使用FBTweak lib。 I wonder is there difference between FBTweakBind and FBTweakValue. 我想知道FBTweakBind和FBTweakValue之间是否有区别。

For example: 例如:

FBTweakBind(self.headerView, alpha, @"Main Screen", @"Header", @"Alpha", 0.85);

can rewrite like this: 可以这样重写:

self.headerView.alpha = FBTweakValue( @"Main Screen", @"Header", @"Alpha", 0.85 );

so are they just equal ? 那他们平等吗?

I figure it out. 我知道了。

FBTweakBinding will refresh the value it's binding. FBTweakBinding将刷新其绑定的值。 It means that FBTweak will call the setter of the property whenever you change the value while app is running. 这意味着当您在应用程序运行时更改值时, FBTweak将调用属性的setter。

FBTweakValue is just a variable. FBTweakValue只是一个变量。 When program is going through that line of code, the property will be set. 当程序通过该行代码时,将设置属性。 If you change the FBTweakValue after where it used, it did nothing, unless that line of code running again. 如果在使用后更改FBTweakValue ,则它什么都不做,除非该行代码再次运行。

I am playing with FBTweak lib only since couple of minutes, but from what I understood from the documentation on github, FBTweakValue is just setting the value, but FBTweakBind is binding the changes to make tweaks update live. 我仅在几分钟后才开始使用FBTweak lib,但是从我从github上的文档中了解到, FBTweakValue只是设置值,但是FBTweakBind绑定了更改以使调整实时FBTweakBind

Keep in mind, that both FBTweakValue and FBTweakBind might behave differently in a release builds 请记住, FBTweakValueFBTweakBind在发行版本中的行为可能有所不同

Source: https://github.com/facebook/Tweaks/wiki#bind 资料来源: https : //github.com/facebook/Tweaks/wiki#bind

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM