Change shortcut without reloading cell

I use a custom UITableViewCell, each cell has a UIImageView. I made the effect for ImageView as parallax (I change the frame for imageView depending on scrollview.contentOffset). Also in the cell I have a button and a tag with tag = 5.

Action for the button:

- (IBAction)likeAction:(id)sender { CGPoint buttonPosition = [sender convertPoint:CGPointZero toView:self.tableView]; NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:buttonPosition]; ((UILabel *)[[(UIButton *)sender superview] viewWithTag:5]).text = [dictionary objectForKey:@"score"]; } 

My question: When I scroll, the frame of imageView (origin.y) changes (the normal position is origin.y = 0, but my effect changes it), for example, when origin.y = -20 I click the button and (!) My image View will return to its first position (for example, the cell has been reloaded, origin.y = 0). If I continue to scroll, imageView will return to origin.y = -20, and then it will be fine. So I get a jump for imageView.

How can I improve it? How can I change the text in the shortcut without reloading the cell? or maybe I can save the position for ImageView to avoid jumping during reboot?

+5
source share
1 answer

try this.....

NSIndexPath *indexPath = [NSIndexPath indexPathForRow:2 inSection:0]; cartCell *cell = [_yourtable cellForRowAtIndexPath:indexPath]; cell.labelname.text=@ "yourtext";

0
source

Source: https://habr.com/ru/post/1214863/


All Articles