LoginSignup
3
4

More than 5 years have passed since last update.

Swift UITableViewCellでxibを使うとエラー "Must translate autoresizing mask into constraints to have _setHostsLayoutEngine:YES."

Last updated at Posted at 2016-03-06

xibを使って、カスタムセルを実装しようとしたら、"Must translate autoresizing mask into constraints to have _setHostsLayoutEngine:YES."というエラーが出て、2時間くらい悩んだ。

要約

  • トップレベルのviewをUITableViewCellにすることで回避

今回の原因

  • 「UIView」が最上部にきていた
  • xibファイルを作った時、デフォルトがUIViewになっている

NGパターン.png

正しい指定方法

  • Viewを消して、UItableViewCellを最上位のViewにすること

OKパターン.png

xibを使ったのが初めてだったので、ハマった。。(使っている人ならわかったのかもしれないけど。。)
StackOverFlowもチェックマークの箇所しか見てなかったけど、ページ下部までよくよく見たら、書いてあるじゃないか。。!今後は、ちゃんと最後まで読もう。。(´・ω・`)

参考)
http://stackoverflow.com/questions/24217195/why-do-i-get-must-translate-autoresizing-mask-into-constraints-to-have-sethost

3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4