LoginSignup
3
3

More than 5 years have passed since last update.

ソースコードでAutoLayoutしてみようとしたらサイズがおかしな事になったのでその対処

Posted at

前提

カスタムキーボードを作っていたらAutoLayoutをしたくなり、その対応をコードで書いてみたら、親Viewからサイズがおかしな事になってしまって悩んだのでそのログ。

エラーログ

こんなエラーログ。

Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand,
refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 

対処方法

エラーログに答えが書いてあるので、ググって対応。以下のコードを追加した。
nextKeyboardButton.setTranslatesAutoresizingMaskIntoConstraints(false)

参照

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