开发者

Xcode - Automatic Scroll

开发者 https://www.devze.com 2023-01-11 22:23 出处:网络
I\'m currently developing an Iphone - App which requires a UITableView to scroll automatically through its cells without requiring the User to make it happen.(The user can if they want) Is there a way

I'm currently developing an Iphone - App which requires a UITableView to scroll automatically through its cells without requiring the User to make it happen. (The user can if they want) Is there a way you can access the scroll function and give it a rate of scroll. i.e. 5 pixels a second or so. So that the UITableView can slowly tick over of its own accord?

An开发者_开发知识库y help would be greatly appreciated.

thanks,

Steven


UITableView won't do this for you automatically, but you can take advantage of the fact that UITableView is a subclass of UIScrollView and update the contentOffset property, most likely via the setContentOffset:animated: instance method. Automate the scrolling by updating the contentOffset property in a method that's called by a NSTimer and you have automatic scrolling.

Make sure you handle the user manually scrolling the UITableView while the automatic scrolling is underway and that you detect the case when the automatic scrolling reached the end of the UITableView. In both cases, the correct action is dependent upon the needs of your app.

0

精彩评论

暂无评论...
验证码 换一张
取 消