cbpowell/MarqueeLabel — pull request #44 by perforator85 (2013-11-24 19:02:07+00:00)
Title: Added notification to restart all labels within a certain viewcontroller...

... and removed not needed code

You now can call [MarqueeLabel controllerLabelsShouldRestart:vc] to reload all labels in a certain viewcontroller

I often use MarqueeLabel in UITableViewCell and need to reload the whole TableView after loading data from the server. Previously I had [_marqueeLabel restartLabel] in "cellForRowAtIndexPath" or "willDisplayCell…". This had one problem: performance while scrolling.

So what i did: (pseudocode)

Case I (drag table and stop dragging: all fine)
1. tableView willBeginScrolling --> [MarqueeLabel controllerLabelsShouldLabelize…]
2. tableView didEndScrolling --> [MarqueeLabel controllerLabelsShouldAnimate…]

Case II (load data from server --> reload table with new data: method missing)
I find this much more convenient to have one method, instead of calling "labelize" and then "animate" with some delays or GCDs

[self.tableView setData:sections];
[self.tableView reloadData];

// NOTE: must be done on main queue to ensure that tableview cells will be reloaded before notifications kicks in
__weak __typeof(&*self)weakSelf = self;
dispatch_async(dispatch_get_main_queue(),^{
[MarqueeLabel controllerLabelsShouldRestart:weakSelf];
});

I hope you like it.

Greetings
Steve