滚动后,TableView单元格颜色重置

时间:2018-05-27 00:24:10

标签: ios swift uitableview cocoa-touch

我正在使用swift制作我的第一个应用程序之一,我希望能够根据天气改变特定单元格的颜色,或者不是已经选择并添加到选定的爱好。无论什么时候这样做似乎都有效,但当我向下滚动并备份时,细胞似乎重置为原始颜色。

Close Xcode and delete the folder <username>.xcuserdatad from within <projectname>.xcodeproj/xcuserdata/. Then restart Xcode, the schemes should re-appear.

非常感谢任何帮助,谢谢

1 个答案:

答案 0 :(得分:1)

cellForRowAt selectedHobbies中检查对象是否在selectedHobbies中并根据该颜色为单元格

   if selectedHobbies.contains(hobby){

     }else{

   }
相关问题