Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
UITableview称重传感器长期Swift-需要建议调整_Uitableview_Swift_Asynchronous - Fatal编程技术网

UITableview称重传感器长期Swift-需要建议调整

UITableview称重传感器长期Swift-需要建议调整,uitableview,swift,asynchronous,Uitableview,Swift,Asynchronous,请参考附件中的代码以及图片中的代码。我需要你的建议我怎样才能更快地装货 哇,为什么在单元格创建中使用dispatch\u async(dispatch\u get\u main\u queue(),{()->Void)呢?不必。删除此方法,代码应该如下所示: override func tableView(tableView: UITableView?, cellForRowAtIndexPath indexPath: NSIndexPath?) -> UITableViewCell

请参考附件中的代码以及图片中的代码。我需要你的建议我怎样才能更快地装货


哇,为什么在单元格创建中使用
dispatch\u async(dispatch\u get\u main\u queue(),{()->Void)呢?不必。删除此方法,代码应该如下所示:

override func tableView(tableView: UITableView?, cellForRowAtIndexPath indexPath: NSIndexPath?) -> UITableViewCell {
let wishRow = self.wishDataList.objectAtIndex(indexPath!.row) as! NSMutableArray
println(userImageList.count)
switch (wishRow).count{

case 4:

    let cell = tableView!.dequeueReusableCellWithIdentifier("CellHeader", forIndexPath: indexPath!) as! WishHeaderTableViewCell
        let dateFormatter = NSDateFormatter()
        cell.LblCity.text = wishRow[1] as? String
        cell.ImgAddWish.layer.cornerRadius = 20
        cell.ImgAddWish.clipsToBounds = true
        cell.ImgAddWish.autoresizesSubviews = false
        //           cell.ImageViewTripOwner.layer.cornerRadius = 20
        //           cell.ImageViewTripOwner.clipsToBounds = true
        cell.ImageViewTripOwner.autoresizesSubviews = false
        for object in self.userImageList{
            if object[0] as? String == (wishRow[3] as? PFUser)?.objectId{

                cell.ImageViewTripOwner.image = UIImage(data: (object[1] as! PFFile).getData()!)

                //SharedFunction.imageResize(UIImage(data: (object[1] as PFFile).getData())!, sizeChange: CGSize(width: 40, height: 40))
            }
        }

    return cell

default:

    let cell = tableView!.dequeueReusableCellWithIdentifier("CellItem", forIndexPath: indexPath!) as! WishItemTableViewCell
        cell.LblItemName.text = wishRow[5] as? String
        cell.ImgItem.image = wishRow[7] as? UIImage
        //UIImage(data: (wishRow[7] as PFFile).getData())
        //SharedFunction.imageResize(UIImage(data: (wishRow[7] as PFFile).getData())!, sizeChange: CGSize(width: 40, height: 40))
        cell.ImgRequestorItem.layer.cornerRadius = 10
        cell.ImgRequestorItem.clipsToBounds = true
        cell.ImgRequestorItem.autoresizesSubviews = false
        cell.ImgRequestorItem.backgroundColor = UIColor.whiteColor()
        for object in self.userImageList{
            if object[0] as? String == wishRow[8] as? String{
                let realImage = UIImageView(frame: CGRect(x: 1.5, y: 1.5, width: 17, height: 17))
                realImage.layer.cornerRadius = 8.5
                realImage.clipsToBounds = true
                dispatch_async(dispatch_get_main_queue(), { () -> Void in
                    realImage.image = UIImage(data: (object[1] as! PFFile).getData()!)
                })
                //SharedFunction.imageResize(UIImage(data: (object[1] as PFFile).getData())!, sizeChange: CGSize(width: 17, height: 17))
                cell.ImgRequestorItem.addSubview(realImage)
            }
        }
        cell.ImgBackgroundTick.layer.cornerRadius = 7.5
        cell.ImgBackgroundTick.clipsToBounds = true
        cell.ImgBackgroundTick.autoresizesSubviews = false
        cell.ImgBackgroundTick.backgroundColor = UIColor.whiteColor()
        let realImage = UIImageView(frame: CGRect(x: 1.5, y: 1.5, width: 12, height: 12))
        realImage.layer.cornerRadius = 6
        realImage.clipsToBounds = true
        realImage.backgroundColor = UIColor(red: 0.450, green: 0.419, blue: 0.321 , alpha: 1)
        realImage.image = UIImage(named: "ic_tick")
        cell.ImgBackgroundTick.addSubview(realImage)
    return cell
}}
override func tableView(tableView: UITableView?, cellForRowAtIndexPath indexPath: NSIndexPath?) -> UITableViewCell {
let wishRow = self.wishDataList.objectAtIndex(indexPath!.row) as! NSMutableArray
println(userImageList.count)
switch (wishRow).count{

case 4:

    let cell = tableView!.dequeueReusableCellWithIdentifier("CellHeader", forIndexPath: indexPath!) as! WishHeaderTableViewCell
        let dateFormatter = NSDateFormatter()
        cell.LblCity.text = wishRow[1] as? String
        cell.ImgAddWish.layer.cornerRadius = 20
        cell.ImgAddWish.clipsToBounds = true
        cell.ImgAddWish.autoresizesSubviews = false
        //           cell.ImageViewTripOwner.layer.cornerRadius = 20
        //           cell.ImageViewTripOwner.clipsToBounds = true
        cell.ImageViewTripOwner.autoresizesSubviews = false
        for object in self.userImageList{
            if object[0] as? String == (wishRow[3] as? PFUser)?.objectId{

                cell.ImageViewTripOwner.image = UIImage(data: (object[1] as! PFFile).getData()!)

                //SharedFunction.imageResize(UIImage(data: (object[1] as PFFile).getData())!, sizeChange: CGSize(width: 40, height: 40))
            }
        }

    return cell

default:

    let cell = tableView!.dequeueReusableCellWithIdentifier("CellItem", forIndexPath: indexPath!) as! WishItemTableViewCell
        cell.LblItemName.text = wishRow[5] as? String
        cell.ImgItem.image = wishRow[7] as? UIImage
        //UIImage(data: (wishRow[7] as PFFile).getData())
        //SharedFunction.imageResize(UIImage(data: (wishRow[7] as PFFile).getData())!, sizeChange: CGSize(width: 40, height: 40))
        cell.ImgRequestorItem.layer.cornerRadius = 10
        cell.ImgRequestorItem.clipsToBounds = true
        cell.ImgRequestorItem.autoresizesSubviews = false
        cell.ImgRequestorItem.backgroundColor = UIColor.whiteColor()
        for object in self.userImageList{
            if object[0] as? String == wishRow[8] as? String{
                let realImage = UIImageView(frame: CGRect(x: 1.5, y: 1.5, width: 17, height: 17))
                realImage.layer.cornerRadius = 8.5
                realImage.clipsToBounds = true
                dispatch_async(dispatch_get_main_queue(), { () -> Void in
                    realImage.image = UIImage(data: (object[1] as! PFFile).getData()!)
                })
                //SharedFunction.imageResize(UIImage(data: (object[1] as PFFile).getData())!, sizeChange: CGSize(width: 17, height: 17))
                cell.ImgRequestorItem.addSubview(realImage)
            }
        }
        cell.ImgBackgroundTick.layer.cornerRadius = 7.5
        cell.ImgBackgroundTick.clipsToBounds = true
        cell.ImgBackgroundTick.autoresizesSubviews = false
        cell.ImgBackgroundTick.backgroundColor = UIColor.whiteColor()
        let realImage = UIImageView(frame: CGRect(x: 1.5, y: 1.5, width: 12, height: 12))
        realImage.layer.cornerRadius = 6
        realImage.clipsToBounds = true
        realImage.backgroundColor = UIColor(red: 0.450, green: 0.419, blue: 0.321 , alpha: 1)
        realImage.image = UIImage(named: "ic_tick")
        cell.ImgBackgroundTick.addSubview(realImage)
    return cell
}}