私はMKMapView
約300の高さを持っています。これは2つの他のビューの間で崩壊します。単純にビューを折りたたむときのように高さを上下にアニメートします。MKMapViewはゼロ高さの制約で苦労します - マップビューのedgeInsets?
@IBOutlet var heightMap: NSLayoutConstraint!
@IBOutlet var theMap: MKMapView!
ビューは、それが高さゼロの起動..
override func viewDidLoad() {
super.viewDidLoad()
..
heightMap.constant = 0
}
それは苦労しているように見えるという腹立たしい警告...
[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:0x6080000904f0 MKMapView:0x7fe6b3000600.height == 0 (active)>",
"<NSLayoutConstraint:0x608000093a60 UILayoutGuide:0x60800018fd80'Edge Insets'.top == MKMapView:0x7fe6b3000600.top + 8 (active)>",
"<NSLayoutConstraint:0x608000093b50 UILayoutGuide:0x60800018fd80'Edge Insets'.bottom == MKMapView:0x7fe6b3000600.bottom (active)>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x608000093b50 UILayoutGuide:0x60800018fd80'Edge Insets'.bottom == MKMapView:0x7fe6b3000600.bottom (active)>
注意があります「edgeInsets」またはおそらく「Edge Insets」(スペースを含む)で、上端と下端、
'Edge Insets'.top == MKMapView:0x7fe6b3000600.top + 8
'Edge Insets'.bottom == MKMapView:0x7fe6b3000600.bottom
マップビューは.alignmentRectInsets
(私はそれが何であれ、それをプリントアウトしたときに実際には、とにかくゼロ..です
let ari = theMap.alignmentRectInsets
print("wth \(ari)")
> wth UIEdgeInsets(top: 0.0, left: 0.0, bottom: 0.0, right: 0.0)
)
読み取り専用のプロパティを持っています私はMKMapViewで "エッジインセット"についての情報を見つけることさえできません、ここで何が取引ですか?
私は、インストールされていない制約と通常の問題を注意深くチェックしました。
あなたは、高さconstriant、下部と上部レイアウト制約の両方の必要はありませんを与えている場合。そのうちの1つを削除してみてください。 – MBN
こんにちは@MBN - いいえ、私は奇妙な 'Edge Insets'topと' Edge Insets 'を追加していません。これらはMKMapKit自体によって追加されたようです。 (「私の」制約はすべて完璧です)。 – Fattie
これは誰も知っている信じられないほどです! – Fattie