我有一个带有六个滑块的小应用程序,我希望允许用户在一个预设中保存所有六个滑块的所需位置。我使用用户设置属性,但这样,下次用户决定在滑块上保存更改时,之前的预设会被新的预设覆盖,我想保存所有这些。所以我想知道该怎么做。是否有可能以某种方式为每个滑块创建用户设置属性列表?
答案 0 :(得分:1)
Even though the question is quite simple, I will (try to) answer it anyway. Let's say your sliders instances are stored in an array. The sliders all have a value from let's say; 0-100. When your application starts, you want to load the values from a file, if it exists. It's important to check this. If the file exists you can do a simple for loop, something like this in pseudocode: for(i=0;i
Then you can do whatever you like, change the values etc.
Then you simply save the file using a similar function for(i=0;i
I hope this helps you on some way, and I'm sorry but I've got to agree with MethodMan, you can just google it