4thSpace
4thSpace

Reputation: 44312

UITableView as a UIScrollView

I've been working with a UIScrollView and have about 200 items to scroll through...so far. This doesn't work since it takes around 45 seconds to load all of the views. I've tried loading the first 20 (about 4 seconds) on the main thread then load in blocks of 50 on other threads. I get the first 20 to scroll through but the others don't appear.

It's taken lots of effort just to get the UIScrollView to work properly and there are still some issues. The UITableView will solve all of this for me since it reuses cells. It's similar to the UIScrollView except more efficient.

I'd like to have one cell take up the entire viewing area and have the user flick through each cell. Rather than freely scrolling through cells, scrolling will stop at each cell and the user must flick again for the next cell. The UITableView doesn't do this that I know of. Is there a way to get this behavior with a UITableView?

Upvotes: 0

Views: 3111

Answers (2)

hatfinch
hatfinch

Reputation: 3095

UITableView is a subclass of UIScrollView. Have you tried simply setting yourTableView.pagingEnabled = YES?

Upvotes: 2

Can Berk Güder
Can Berk Güder

Reputation: 113300

Short answer: no.

You can try to control UITableView's scrolling behavior using the delegate methods, or better yet, stick with UIScrollView and load the views one-by-one in the UIScrollViewDelegate methods.

Upvotes: 1

Related Questions