Reputation: 391
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?
Upvotes: 1
Views: 198
Reputation: 391
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.
Upvotes: 1
Reputation: 1666
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......
Upvotes: 0