简体   繁体   English

如何从AWS S3解析/请求对象以填充自定义UICollectionView?

[英]How do I parse/request objects from AWS S3 to populate a custom UICollectionView?

I am looking to achieve an interface similar to that of iBooks, where there is a master view that contains thumbnail images of books/magazines/articles in a grid form, like so: 我希望实现类似于iBooks的界面,在该界面中有一个主视图,其中包含网格形式的书/杂志/文章的缩略图,例如:

在此处输入图片说明

Now I am just inferring that they used a custom UICollectionView to achieve this interface, however if there is another method, I am well open to implement it. 现在我只是在推断他们使用了一个自定义的UICollectionView来实现此接口,但是,如果有其他方法,我很乐意实现它。 My question is, I have all my thumbnail images/objects uploaded in a bucket back in Amazon s3, how do i parse those onto a custom UICollectionView to populate it, creating the same interface as shown above? 我的问题是,我将所有缩略图/对象都上传到了Amazon s3的存储桶中,如何将其解析到自定义UICollectionView上以填充它,并创建与上图所示相同的界面? what code should I implement in swift? 我应该迅速实现哪些代码?

You should do the following: 您应该执行以下操作:

  1. Fetch JSON from the server that describes available items. 从服务器获取描述可用项目的JSON。 You can use AFNetworking or Alamofire for this. 您可以为此使用AFNetworkingAlamofire
  2. Parse the JSON data into objects 将JSON数据解析为对象
  3. Create a UICollectionViewController and UICollectionViewFlowLayout subclasses that define iBooks-like UI (you can take a look at this and this examples) 创建一个定义的iBooks般的UI一个UICollectionViewController和UICollectionViewFlowLayout子类(你可以看看这个这个例子)
  4. It would be better to use some opensource solution for image loading/caching as well. 最好也使用一些开源解决方案来进行图像加载/缓存。 Like SDWebImage SDWebImage

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM