Load custom table view cell from xib if it contains multiple views

  var cell : UploadedPhotoTableCell!=tableView.dequeueReusableCellWithIdentifier("UploadedPhotoTableCell") as? UploadedPhotoTableCell
        
        if cell == nil
        {
            let topLevelObjects: [AnyObject] = NSBundle.mainBundle().loadNibNamed("UploadedPhotoTableCell", owner: self, options: nil)
            for currentObject: AnyObject in topLevelObjects {
                if (currentObject is UITableViewCell) {
                    cell = currentObject as! UploadedPhotoTableCell
                }
            }
        }




// It it UITableViewCell class contains only one view i.e content view 

  var cell : UploadedPhotoTableCell!=tableView.dequeueReusableCellWithIdentifier("UploadedPhotoTableCell") as? UploadedPhotoTableCell
        
        if cell == nil
        {
            tableView.registerNib(UINib(nibName: "UploadedPhotoTableCell", bundle: nil), forCellReuseIdentifier: "UploadedPhotoTableCell")
            cell = tableView.dequeueReusableCellWithIdentifier("UploadedPhotoTableCell") as? UploadedPhotoTableCell
        }

Comments

Popular posts from this blog

Vector graphics in iOS

Exception Handling - Objective C

How to show activity indicator in watch kit