Xcode 不确定如何从UITableViewCell中的UISwitch更新Plist中的布尔值

Xcode 不确定如何从UITableViewCell中的UISwitch更新Plist中的布尔值,xcode,uitableview,boolean,plist,uiswitch,Xcode,Uitableview,Boolean,Plist,Uiswitch,我有一张四行的桌子,每行都有一个标题和开关作为附件。我希望在点击相应的开关时更新plist布尔值 Plist: <array> <dict> <key>Bools</key> <array> <false/> <false/> <false/> <false/&

我有一张四行的桌子,每行都有一个标题和开关作为附件。我希望在点击相应的开关时更新plist布尔值

Plist:

<array>
    <dict>
        <key>Bools</key>
        <array>
            <false/>
            <false/>
            <false/>
            <false/>
        </array>
        <key>Strings</key>
        <array>
            <string>String0</string>
            <string>String1</string>
            <string>String2</string>
            <string>String3</string>
        </array>
    </dict>
</array>
这是我的开关,带有选择器:switchToggled

UISwitch *switchView = [[UISwitch alloc] initWithFrame:CGRectZero];
cell.accessoryView = switchView;
[switchView addTarget:self action:@selector(switchToggled:) forControlEvents: UIControlEventTouchUpInside];
下面是IBAction方法。我可以成功地将开关点击以显示在日志中,因此我知道一切正常。我只是不知道如何获得要更新的正确布尔值

- (IBAction)switchToggled:(id)sender {
NSLog(@"switch tapped");
}

感谢您的帮助!谢谢。

当我发布这篇文章时,我对编程非常陌生,我不知道我不能在运行时以编程方式编辑主捆绑包中的plist。我现在明白了,为了达到我想要的效果,我应该将起始plist保存到app documents目录中,并从中开始工作。我用这篇文章来帮助格式化在documents目录中保存和加载数据的过程。

按下开关后,您需要更新模型。并使用此模型更新开关状态。
- (IBAction)switchToggled:(id)sender {
NSLog(@"switch tapped");
}