2017-06-22 11 views
1

私の画面にはUITableViewがあります。 動的高さがのセクションヘッダーと行を示しています。
Xcode8.3からXcode-9ベータに移行したときに、この設定には2つの問題があります。壊れた行のXcode-9ベータ版のAutolayoutが壊れていた

1ヘッダビューの高さが壊れ
2動的な高さ

私がセットアップしている私のテーブルビューをよう:

enter image description here enter image description here

は、その後、私はカスタムセル

を持っています

enter image description here
0ここでenter image description here
enter image description here

コードです:

func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat { 
    return //dynamically calculated height according to msg text 
} 
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { 
    return 30 
} 

func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { 
    let headerHeight:CGFloat = tableView.sectionHeaderHeight 
    let headerView = HeaderView(frame: CGRect(x: 0, y: 0, width: tableView.width, height: headerHeight), withHeaderLable: "Date/Day of msg") 
    return headerView 
} 

これはさえのMSGの複数行とXcode8.3に完璧に動作しますが、としてXcode9ベータ版で壊れ:私はSwift3.2設定で実行すると Xcode9のベータ版:

enter image description here

私はXcode9ベットでSwift4設定で実行A:

enter image description here

は何、この動作の理由でしょうか?

+0

なぜベータ版を使用していますか? –

+4

@elk_clonerその質問には、ベータ版を使用する必要があります。これは、今後の技術に挑戦するイニシアチブです。これが本当にアップルのバグであれば、そのような課題に直面し、適切な解決策を見つけることは役に立ちます。 – Krunal

答えて

3
tableView.rowHeight = UITableViewAutomaticDimension 
tableView.estimatedRowHeight = 30.0 

あなたviewDidLoadとテーブルビューのデリゲートメソッドestimatedHeightForRowAtが不要でこれを追加します。

+0

xcode9ではなくxcode8.3でこれがなぜ必要なのか不思議です! – D4ttatraya

+0

実際には、ヘッダの問題は自動レイアウトに関係しません。これは 'NSFetchedResultsController'に関連しています。 [これについての質問](https://stackoverflow.com/q/44804683/5546312) – D4ttatraya

関連する問題