UITableView got slowly when dragging
I am new to iPhone development, and I can not understand the working principle of UITableView well.
I custom开发者_JS百科ize the UITableViewCell, and the cell contains imageview. In addition, I initialize the cell reusable. However, when I drag the UITableView, it scrolls slowly.
Then what should I do to process it?
If you are loading images from your applications bundle you can increase the scroll speed by making the images the exact size they need to be to fit in the UITableViewCell imageView so the device doesn't have to size them on the fly. Do this by adding smaller versions of the images in your applications bundle, or by resizing them in code as needed in a background thread.
Alternatively if this solution won't work for you, or you are loading images from the internet have a look at Lazy loading images in UITableView, a process where images are only loaded when needed and can be downloaded asynchronously.
Alternatively, you can use a prebuilt class to do your image downloading, caching and lazy loading for you like TTImageView or SDWebImage.
精彩评论