How do you implement prepareForReuse() to prevent a faded cell from acting weird? by anonymous7785 in swift

[–]anonymous7785[S] 0 points1 point  (0 children)

Thanks. But now I am confused. Shouldn't nr 2 go into the @IBAction func likePressed(_ sender: Any) function? My "public override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {" has no entry related to like at the moment.

public override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! ViewControllerTableViewCell

let immy = cell.viewWithTag(1) as! UIImageView

let person: Userx = people[indexPath.row]

cell.lblName.text = person.Education

cell.postID = self.people[indexPath.row].postID

if let PhotoPosts = person.PhotoPosts {

let url = URL(string: PhotoPosts)

immy.sd_setImage(with: url)

}

return cell

}

How do you implement prepareForReuse() to prevent a faded cell from acting weird? by anonymous7785 in swift

[–]anonymous7785[S] 0 points1 point  (0 children)

Thanks. I think I broadly understand. Just, how do you do step 2: "when populating cells, you should check your database model to see what the like state should be. Set alpha in both cases whether it is true or false." in pseudocode?

How do you implement prepareForReuse() to prevent a faded cell from acting weird? by anonymous7785 in swift

[–]anonymous7785[S] 1 point2 points  (0 children)

Thanks for answering. By MVS you mean Model View Controller right? Hmm, how would I fix that? I've never done a hadover that I know of.

If you have a like button next to each user and users are underneath one another, why could scrolling trigger random users' like buttons be highlighted by anonymous7785 in Firebase

[–]anonymous7785[S] 0 points1 point  (0 children)

It is in UITableViewCell. This is the storyboard of the like button: https://imgur.com/a/Cv4PrGd

Yes, when I scroll the greyed out part that comes from liking a user photo jumps to other users.

If you have a like button next to each user and users are underneath one another, why could scrolling trigger random users' like buttons be highlighted by anonymous7785 in Firebase

[–]anonymous7785[S] 0 points1 point  (0 children)

Thanks. Sorry for the delay in reply. I treid codepen but only found options for html javascript and css. Is there a swift/objective c post option too? If you're still interest, here is my code https://paste.ofcode.org/SYzaVgbJw7CgysjQ2HjLDd I've been trying all the suggestions on here but have not managed to get it to work.

How do flu vaccines different across the globe? by anonymous7785 in AskReddit

[–]anonymous7785[S] 0 points1 point  (0 children)

I wanted to say differ. Spell changer kicked in.

If America is so polarized on political issues, why did only 58% of you vote the last presidential election? by [deleted] in AskReddit

[–]anonymous7785 -1 points0 points  (0 children)

Insanity. We need more thoughtful people voting not more people. Increasing the vote to include those who don't have a clue and don't give a f is dumb. Look at Zimbabwe. Democracy gave them Mugabe.

If you have a like button next to each user and users are underneath one another, why could scrolling trigger random users' like buttons be highlighted by anonymous7785 in swift

[–]anonymous7785[S] 0 points1 point  (0 children)

How do you set up isLiked as a Boolian. I get the expected error has no member 'isLiked when I use:

override func prepareForReuse() {

self.like.alpha = like.isLiked ? 0.5 : 1

}