Help us understand the problem. What is going on with this article?

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

More than 3 years have passed since last update.

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

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした