I'm working on an app that will show notifications, allow the user to post comments and edit the notification and see comments on the notification.
To do this I have 3 Prototype cells called "Active", "Control" and "Comment" cells. My first two Active and Control look and work fine with their auto-sizing on all devices. The comment cell, however, shrinks on Plus-sized iOS Devices, not including iPads to an unreadable size.
The comment cell simply has 3 labels of slightly different sizes and colors inside of a Stack View. This is on Swift 4.
The list of devices this happens on: 6+, 6s+, 7+, 8+, X, Xs, Xs Max
https://i.sstatic.net/K80Y9.jpg
The above shows the cell as expected on an iPhone XR and as unexpected on an Xs Max
I've tried editing the compression and hugging rules, tried to use a constraint to force the height (which technically worked however it ruined the look and threw a warning).
func numberOfSections(in tableView: UITableView) -> Int { if activeEvents.count == 0 { self.tableView.isHidden = true self.activityIndicator.isHidden = false self.activityLabel.isHidden = false self.activityIndicator.startAnimating() } else { self.tableView.isHidden = false self.activityIndicator.isHidden = true self.activityLabel.isHidden = true self.activityIndicator.stopAnimating() } return activeEvents.count } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { if activeEvents[section].expanded { return activeEvents[section].comments.count + 2 } else { return 1 } } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { if indexPath.row == 0 { let activeEvent = activeEvents[indexPath.section] let cell = tableView.dequeueReusableCell(withIdentifier: "activeCell") as! ActiveCell cell.selectionStyle = .none cell.setCell(active: activeEvent) return cell } else if indexPath.row == 1 { let activeEvent = activeEvents[indexPath.section] let cell = tableView.dequeueReusableCell(withIdentifier: "controlCell") as! ControlCell cell.setNoti(active: activeEvent) cell.selectionStyle = .none cell.delegate = self cell.vc = self return cell } else { let activeEvent = activeEvents[indexPath.section] let activeComment = activeEvent.comments[indexPath.row - 2] let cell = tableView.dequeueReusableCell(withIdentifier: "commentCell") as! CommentCell cell.setCell(comment: activeComment) return cell } }