我可以通过这段代码在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的后缀一元运算符
我正在使用 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)