我正在尝试在我的社交网络iOS应用程序中实现一个点赞功能-使用Swift、Parse作为后端和Storyboard-用户可以在其中点赞(和点赞)类似于Instagram或FacebookiOS应用程序的帖子。唯一的问题似乎是,当用户滚动帖子的表格View提要时,当前用户不喜欢的其他帖子显示填充的喜欢按钮图像(好像他们被喜欢,但他们没有).根据我的研究,我了解到这可能是因为tableview中的单元格是可重用的(通过tableView.dequeueReusableCellWithIdentifier。)*这是有道理的,因为当用户打开应用程序时,仅加载可见单元格。当用户滚动表格View时
这是一个相当简单的情况:我有自定义的UITableViewCell类,它有自己的属性、socket和东西。其中有两个UIButtons->Like和Dislike。您可以将它们视为喜欢或不喜欢评论按钮。我已经像这样向它们添加了IBAction(在TableViewController中,而不是CustomCell类中):-(IBAction)likeComment:(UIButton*)sender{CustomTableCell*thisCell=(CustomTableCell*)[[[sendersuperview]superview]superview];//tofetchth
我有一个带有按钮的UITableView,该按钮根据用户是否“收藏”帖子进行切换。一切正常,除了滚动表格View时,按钮会发生变化。这是我的代码:functableView(tableView:UITableView,numberOfRowsInSectionsection:Int)->Int{guardletfeed=self.feedelse{return0}returnfeed.count}functableView(tableView:UITableView,cellForRowAtIndexPathindexPath:NSIndexPath)->UITableViewCell
我有一个带有按钮的UITableView,该按钮根据用户是否“收藏”帖子进行切换。一切正常,除了滚动表格View时,按钮会发生变化。这是我的代码:functableView(tableView:UITableView,numberOfRowsInSectionsection:Int)->Int{guardletfeed=self.feedelse{return0}returnfeed.count}functableView(tableView:UITableView,cellForRowAtIndexPathindexPath:NSIndexPath)->UITableViewCell