1

I want to have a UIImageView follow the first cell down when scrolling down. So to do that, I thought I might try:

CGRect rect = [foldersTable convertRect:[foldersTable rectForRowAtIndexPath:indexPath2] toView:[foldersTable superview]]; 
imageView.frame=rect;

The problem is that the rect is not updating live as I scroll the table view. Where would I have to place the above code so that it updates as I scroll the table? Or am I missing anything else?

bitmoe
  • 391
  • 2
  • 5
  • 13
  • Are you saying that it's not "live" because the value you are getting doesn't change when the table is scrolled? Or are you asking where to put this code so that it will be called whenever the scroll offset of the table is changed? – Alex Nichol Sep 04 '11 at 02:05
  • There is a similar post which got the working answer: [http://stackoverflow.com/questions/687793/determine-coordinates-of-a-uitableviewcell-while-scrolling][1] [1]: http://stackoverflow.com/questions/687793/determine-coordinates-of-a-uitableviewcell-while-scrolling – dsfdf Jul 17 '12 at 14:43

2 Answers2

1

The correct way to do this is:

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
    CGPoint offset=foldersTable.contentOffset;
    CGRect newFrame=CGRectMake(111, offset.y, 100, 100);
    longRope.frame=newFrame;
}

This way it updates live as the scrollView in the tableView scrolls.

bitmoe
  • 391
  • 2
  • 5
  • 13
0

As UITableView inherits UIScrollView, check if contentOffset property can help to find how much you scrolled.

if its working then you can easily figure out rect if UIImageView with calculation.

If you need further details then post here......

Mohammad
  • 1,636
  • 1
  • 13
  • 17