Program crashes when loading 200+ subview images in the UIScrollView

前端 未结 3 409
情深已故
情深已故 2021-01-28 07:00

I am developing a similar program like Photos in the iPhone using ALAssetLibrary. I am trying to load the images in a scrollview. Everything works fine when the album has small

3条回答
  •  没有蜡笔的小新
    2021-01-28 07:57

    why not use UICollectionView and UICollectionViewController classes? UICollectionViewController reference here

    sample code here.

    Your images will end up being instances of UICollectionViewCell. The data source and delegate protocol methods are similar to the UITableView methods. i.e. they provide a mechanism where the UICollectionViewController will reuse the UICollectionViewCells.

    The benefit of using these classes is that they are used similarly to UITableViewControllers and they assist you with the memory pressure issues that you are having.

    good luck!

提交回复
热议问题