小编Mat*_*at0的帖子

加载更多数据时CollectionView复制单元格

问题:

我有一个CollectionView,它将UIimage加载到每个单元格中.但是我的问题是,当我加载包含更多图像的其他单元格时,它们似乎会重复.我无法在我的代码中看到可能导致这种情况的原因.可能是因为可重复使用的细胞存在一些问题?

谁能明白为什么会这样?

注意:带有图像的阵列没有重复项

问题视频: https ://www.youtube.com/watch?v = vjRsFc8DDmI

问题形象:

加载更多数据时,CollectionView具有重复的单元格

这是我的collectionView函数:

func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
    //#warning Incomplete method implementation -- Return the number of items in the section
    if self.movies == nil
    {
      return 0

    }

    return self.movies!.count

}

func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell 
{
    let cell =    
      collectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, 
        forIndexPath: indexPath) as! UpcomingCollectionViewCell

   if self.movies != nil && self.movies!.count >= indexPath.row
    {
        // Calc size of cell
        cell.frame.size.width = screenWidth …
Run Code Online (Sandbox Code Playgroud)

uiimageview collectionview ios swift

12
推荐指数
1
解决办法
6107
查看次数

使用[indexPath.section] [indexPath.row]模糊地使用下标

在我更新到Xcode 7.2之后,出现了一个错误,上面写着"下划线的模糊使用":

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
      let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath)

      /*ERROR - Ambiguous use of subscript*/
      cell.textLabel?.text = self.tvArray[indexPath.section][indexPath.row] as? String 

      //..... more code
}
Run Code Online (Sandbox Code Playgroud)

谁能告诉我在实施tvArray时我做错了什么?

设置:

var tvArray = []

override func viewWillAppear(animated: Bool) {
super.viewWillAppear(true)

  //..... more code
  tvArray = [["Airing Today", "On The Air", "Most Popular", "Top Rated"], ["Action & Adventure", "Animation", "Comedy", "Documentary", "Drama", "Family", "Kids", "Mystery", "News", "Reality", "Sci-Fic & Fantasy", "Soap", "Talk", "War & Politics", "Western"]]
  //..... …
Run Code Online (Sandbox Code Playgroud)

arrays ambiguous ios swift swift2

1
推荐指数
1
解决办法
709
查看次数

用于加密/解密时处理更改密码的最佳方法

问题:

我需要加密/解密大量数据.使用密码(更具体地使用RNCrytor lib)对该数据进行加密/解密.一个人应该能够更改此密码.

我的问题是如何最有效地完成这项工作?

我不是那么好的解决方案:

除了循环遍历所有数据并对其进行解密之外,必须有更好的方法.然后使用新密码再次加密它.

encryption passwords cryptography change-password swift

1
推荐指数
1
解决办法
1197
查看次数