开发者

How to keep accessory view set when leaving the view then coming back later

I have not attempeted this before so would like people opinion on how best to handle tableviewcell tick accessory, I have set this up so that when the user selects their uitableview cell they are directed back to the main view and the value of the cell selected is loaded into the main view, I have done this using protocols and delegates like so

My question is, if the user decides to go back to the view where the accessory is how do I make sure the tick stays their? is their a special method I 开发者_如何学Ccan use? or will i have to pass the indexpath to the main view then back again using delegates and protocols?

Anyway any help would be greatly appreciated.


You have the answer in your question. You will need to keep a reference with what indexPath was selected. And you this value can be saved on to AppDelegate or which ever method you may choose. When the user wishes to go back to the view, you will simply need to check for saved values, and load them on to the UITableView with tableView reloadData.

You will have to set the accessoryView in the cellForRowAtIndexPath and provide the check for saved values there. You can reloadData in the viewWillAppear method.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜