Dmi*_*try 4 objective-c nsuserdefaults uiswitch reactive-cocoa
如何绑定UISwitch.on
密钥的值NSUserDefaults
?
小智 9
您可以通过以下方式绑定它们(双向绑定):
RACChannelTerminal *switchTerminal = self.someSwitch.rac_newOnChannel;
RACChannelTerminal *defaultsTerminal = [[NSUserDefaults standardUserDefaults] rac_channelTerminalForKey:@"someBoolKey"];
[switchTerminal subscribe:defaultsTerminal];
[defaultsTerminal subscribe:switchTerminal];
Run Code Online (Sandbox Code Playgroud)
交换机的on
状态以用户默认值或的值开头NO
.
归档时间: |
|
查看次数: |
1544 次 |
最近记录: |