小编Ash*_*ues的帖子

如何在swift中使用in循环递减条件?

我可以通过这段代码在Swift中使用for循环

   for i in 0..<5
{
    print ("Four multiplied by \(i) results in \(i*4)" )
}
Run Code Online (Sandbox Code Playgroud)

但是我如何使用低于">"条件的for.

  for i in 10>..5
{
    print ("Four multiplied by \(i) results in \(i*4)" )
}
Run Code Online (Sandbox Code Playgroud)

它显示 错误:'>'不是10>中的i的后缀一元运算符

for-in-loop ios swift xcode7.3

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

致命错误:在 UICollectionView 中使用 Alamofire 解包可选值 Swift 时意外发现 nil

我正在使用 Alamofire 从网络服务获取图像。我使用以下代码在 UICollectionView 的自定义单元格中显示这些图像

func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
    let reuseIdentifier = "cell"
    // get a reference to our storyboard cell
    let cell : ImageCollectionCell = collectionView.dequeueReusableCellWithReuseIdentifier("cellCollection", forIndexPath: indexPath) as! ImageCollectionCell

    // Use the outlet in our custom class to get a reference to the UILabel in the cell
    cell.backgroundColor = UIColor.yellowColor() // make cell more visible in our example project
    let imageGalleryURLString = self.MutableArray.objectAtIndex(indexPath.row) .valueForKey("thumbnail") as! String
    let imageURL = NSURL(string:imageGalleryURLString)
    cell.imageviewCollectionCell.sd_setImageWithURL(imageURL)
    return cell …
Run Code Online (Sandbox Code Playgroud)

ios uicollectionview uicollectionviewcell swift swift2

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