LoginSignup
3
1

More than 5 years have passed since last update.

The view hierarchy is not prepared for the constraintが出たら見るページ

Posted at

addSubViewしてからaddConstraints

「The view hierarchy is not prepared for the constraint」が出たら順番が実装の順番を確認してください。

addSubViewしてからaddConstraintsをしましょう。

//viewを作成
let myView = UIView()
//autolayoutを使用
myView.translatesAutoresizingMaskIntoConstraints = false

self.view.addSubView(myView)

//NSLayoutConstraintの配列をセット
self.view.addConstraints([NSLayoutConstraint])

・参考
[Xcode6][Swift][iOS]雑記3 | た~みなるねんど
http://w.terminal-end.net/?p=955

3
1
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
1