は、コンソールログを確認し、このコードを使用してください。あなたが最後の制約(UIViewの-カプセル化されたレイアウト-高さ)気づけば、あなたがいることがわかります。ここ
[LayoutConstraints] 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.
(
"<NSLayoutConstraint:0x60000009cd90 UIImageView:0x7fe661539400.height == 46 (active)>",
"<NSLayoutConstraint:0x60000009ce30 V:|-(5)-[UIImageView:0x7fe661539400] (active, names: '|':UITableViewCellContentView:0x7fe661531100)>",
"<NSLayoutConstraint:0x60000009ce80 V:[UIImageView:0x7fe661539400]-(5)-| (active, names: '|':UITableViewCellContentView:0x7fe661531100)>",
"<NSLayoutConstraint:0x60000009d6f0 'UIView-Encapsulated-Layout-Height' UITableViewCellContentView:0x7fe661531100.height == 43.5 (active)>"
)
- :私は、同様のエラーを得たとき、私の場合、私は、コンソールでこのような何かを得ましたシステムはそれ自身で異なるテーブルビューのセルの高さをとります。ですから最初はあなたのimageViewの高さはあなたの制約で設定したものです(私の場合は46です)。したがって、imageView.bounds.height/2は23になります。しかし、テーブルが表示されている場合、システムはそれとは異なる高さ(43.5)最後の制約で述べた。
私のImageViewのは、セルに(上から下へと5と5)を上部と下部の制約があり、それはにリサイズされますので:43.5から5(上) - 5(下)= 33.5
だから今最初に非円形画像の原因となるサイズ33.5の画像にコーナー半径23を適用しています。 2回目の画像サイズは33.5で、imageView.bounds.height/2 = 33.5/2 = 16.75が得られます。したがって、それは2回目以降も有効です。
イメージの高さの制約とトップとボトムの制約を与えても、テーブルビューにセルの高さが適用されないようにするには、コードでこれを行うことができます。
self.tblDemo.estimatedRowHeight = 70.0
self.tblDemo.rowHeight = UITableViewAutomaticDimension
これは、問題を解決し、円形画像を初めて提供するはずです。
私はこのメソッドを試しただけで、まだ動作しません。 circularImageView.bounds.heightの値は、制約値ではなく、ペン先の任意の集合です。 –