等效于 UISwtich 中的 UISegmentedControl selectedSegmentIndex- Objective C
Equivalent of UISegmentedControl selectedSegmentIndex in UISwtich- Objective C
我正在尝试将 UISegmentedControl 转换为 UISwitch。我成功地检查了开关的状态。
然后我看到了这行代码:
self.mobile3GSegment.selectedSegmentIndex = [mConfigurationService getBoolWithKey:NETWORK_USE_3G];
我试图猜测 UISwitch 是如何做到的。所以...
self.mobile3GSwitch.state = [mConfigurationService getBoolWithKey:NETWORK_USE_3G];
然后我得到这个错误:
Property 'selectedSegmentIndex' not found on object of type UISwitch
我知道 UISwitch 不是一个段并且 returns 是或否。错误不是这里的重点。我想了解的是如何转换代码段以使其适用于 UISwitch。
我现在几乎迷路了。这样做的正确方法是什么?
我正在尝试将 UISegmentedControl 转换为 UISwitch。我成功地检查了开关的状态。
然后我看到了这行代码:
self.mobile3GSegment.selectedSegmentIndex = [mConfigurationService getBoolWithKey:NETWORK_USE_3G];
我试图猜测 UISwitch 是如何做到的。所以...
self.mobile3GSwitch.state = [mConfigurationService getBoolWithKey:NETWORK_USE_3G];
然后我得到这个错误:
Property 'selectedSegmentIndex' not found on object of type UISwitch
我知道 UISwitch 不是一个段并且 returns 是或否。错误不是这里的重点。我想了解的是如何转换代码段以使其适用于 UISwitch。
我现在几乎迷路了。这样做的正确方法是什么?