plainspace / cp-db-1

CodePath: Dropbox 1
0 stars 0 forks source link

Favorites button state is persisted in memory but not in UI #5

Open plainspace opened 8 years ago

plainspace commented 8 years ago

@codepathreview @codepath I updated favoriting as discussed in class last night. The state is still not being persisted in the favorite button but it is apparantly being saved in the app as you can see in the GIF below.

ffe1587ecdd43671a35533dcfb4e98496f53cac4

db-1-fav

plainspace commented 8 years ago

Here is the code I'm using in viewDidLoad:

        let favorited = NSUserDefaults.standardUserDefaults().boolForKey("favorited")

        if favorited == true {
            LikeButton.hidden = true
            LikedButton.hidden = false
            print("favorited button")
        } else {
            LikeButton.hidden = false
            LikedButton.hidden = true
            print("not favorited button")
        }

here is a GIF with the bug. you can see that it works but when i return to the files tab the first time, the button is on but doesn't turn on and off even though the event is firing. when i go to the favorites tab and back to the files tab the button states gets cleared and works again.

db-1-fav1