UITableViewCell does not respect device modifier in search

27 views Asked by At

I have a UITableViewCell in a xib named MyCell.xib and MyCell~ipad.xib for a universal application. When the table view loads (queue cell for reuse, and dequeue as per usual) everything looks fine. However, when using the UISearchDisplayController (using the same typical dequeue-ing as before), the ~ipad xib is not used and it defaults to the general xib.

Not sure what would be helpful to see here, so feel free to ask for more information. I need to be able to use device modifiers on my xibs for these cells to adjust font sizes and icon sizes properly.

Registering cell in viewDidLoad

self.table.register(UINib(nibName: XIBFiles.TEAMCELL, bundle:nil), forCellReuseIdentifier: self.GENERATEDCELL)

Code for getting cell for row

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        if tableView == self.table {
            if self.bottomCell != nil && indexPath.row == data!.count {
                return bottomCell!
            }
            else{
                return self.cellForObject(data![(indexPath as NSIndexPath).row])
            }
        }
        else {
            return self.cellForObject(searchData[(indexPath as NSIndexPath).row])
        }
    }

Helper code for getting cell

//Set up search controllers
        func cellForObject(object) -> UITableViewCell {
            let teamCell = tableController.table.dequeueReusableCell(withIdentifier: self.GENERATEDCELL) as! TeamCell

            teamCell.team = (object as! Team)
            return teamCell
        }
0

There are 0 answers