views:

403

answers:

3

Hello,

My goal is to have the UITableViewCells fade in/out when they are approaching the bounds of the UITableView and about to be covered/revealed.

The approach I have been trying is to get the coordinates of the UITableViewCell during a scroll event. The problem is that every cell seems to be at 0,0. I have tried converting the coordinates to the parent table and view, but they still come out at 0,0.

So in general, if anyone knows a way to get the coordinates, or of a better way to go about fading UITableViewCells in and out based on their position, I would greatly appreciate any advice you may have.

Thanks for your time, Joel

A: 

I suspect the cells are held within 'cell sized' subViews of the UITableView so you are seeing a frame relative to that view.

I don't have an actual an answer for you but, I would suggest checking out UIScrollView's delegate class: UIScrollViewDelegate. It responds to – scrollViewDidScroll: and you can manually work out your offset from that. UIScrollView is a superclass of UITableView.

You can convert points (such as your origin) to another view's co-ordinates using UIView's - (CGPoint)convertPoint:(CGPoint)point toView:(UIView *)view method.

Roger Nolan
A: 

Why not an overlay with a partially transparent gradient PNG in a UIImageView that's less translucent at the top and bottom?

Messing with cell drawing in table scrolling is going to take a big performance hit.

Kendall Helmstetter Gelner
+2  A: 

You can call

- (CGRect)rectForRowAtIndexPath:(NSIndexPath *)indexPath;

to get the rect of any given cell. This will contain it's coordinates in the origin struct within the rect.

Jasarien