IPhone SDK - How to scroll a UITableView programmatically with animation?

Try commenting out the reloadData call. If I'm understanding your question correctly, and you're in viewDidLoad you should not need to call it anyway Also, if you've just gotten done pushing the view controller, you won't get an animated scroll. You'll have to insert a delay (I've found a quarter second works well) between the time that viewDidLoad was called and when your animation starts.

Try commenting out the reloadData call. If I'm understanding your question correctly, and you're in viewDidLoad, you should not need to call it anyway. Also, if you've just gotten done pushing the view controller, you won't get an animated scroll.

You'll have to insert a delay (I've found a quarter second works well) between the time that viewDidLoad was called and when your animation starts.

I have noticed some animations behave differently in the simulator. Is it possible you are calling scrollToRowAtIndexPath:atScrollPosition:animated twice in quick succession? This can 'confuse' the animation.

You should call this function only once while processing a given event.

Thanks for your reply. I'm running the code on the device and calling this code in the viewDidLoad method. – dan Mar 1 '10 at 22:24 It may be that, for whatever reason, an animation can't be started from viewDidLoad because this is part of the view initialisation.

I'm not saying I know why exactly that would be, but it sounds plausible. Try scheduling an event with NSRunLoop's performSelector, and do your scroll when that is called. – richb Mar 1 '10 at 22:45.

It works very well for me: -(void) viewDidAppear:(BOOL)animated{ NSIndexPath *indexPath = NSIndexPath indexPathForRow:n inSection:0; self. TableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:YES; } To be shore that this is called only one time, you can make a verification like: if(!isInitialized){ isInitialized = YES; .... }.

Try commenting out the reloadData call. If I'm understanding your question correctly, and you're in viewDidLoad, you should not need to call it anyway.

Love programming for iPhone. NSURLConnection/NSURLRequest gzip support! How to resize a UISwitch?

IPhone SDK - How to scroll a UITableView programmatically with animation?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions