0

I have an UITableView which has UIViews inside each cell (actually I'm using EasyTableView) and inside that view there are 3 UIImageViews changing images every 1/3 of a second.

The problem is, that the images change only while there's no scrolling happening.

I read some issues about this and I found people suggesting the use of NSRunLoop, but that's for NSURLConnection when loading external images, I'm using "UIImage imageNamed" and UIImageView's setImage. The other suggestion I read was to use NSInvocationOperation, but had no luck with that either.

    NSInvocationOperation *invocation = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(changeProgress) object:nil];
[invocation start];

Maybe I'm doing it wrong, please help! Thanks.

William
  • 61
  • 1
  • 1
  • 5

2 Answers2

0

Did you try this?

UIScrollView redrawing content while scrolling?

Community
  • 1
  • 1
Joris Mans
  • 6,024
  • 6
  • 42
  • 69
  • I tried setNeedsDisplay within the "changeProgress" method, but the problem is that changeProgress isn't called while scrolling, it just halts the timer I created. And adding UIScrollViewDelegate to it breaks EasyTableView :( – William Apr 19 '11 at 23:22
0

A friend found the solution, I had to create the timer without scheduling it, and add it to the NSRunLoop, so the code would be like this:

    _timer = [NSTimer timerWithTimeInterval:1.0/3.0 target:self selector:@selector(update:) userInfo:nil repeats:YES];
    [[NSRunLoop mainRunLoop] addTimer:_timer forMode:NSRunLoopCommonModes];
William
  • 61
  • 1
  • 1
  • 5