私はこの奇妙な問題があります(私はこのようなエラーは一度も見たことがないためです)、私のビューにTextfieldがあります。両側(トレーリングや大手)が、問題がある。このそのだけ(どちらか末尾またはリーディング)1つの側から拡大Xcodeは、ビューを水平に中央に置かないようにしています
私のコード:
のViewControllerクラス
@IBOutlet var constraint1: NSLayoutConstraint! // textfield's leading constraint
@IBOutlet var constraint2: NSLayoutConstraint! // textfield's trailing constraint
viewDidload(){........}
@IBAction func editingBegin(sender: AnyObject) {
fullnameTextField.layer.cornerRadius = 0
fullnameTextField.clipsToBounds = false
self.constraint2.constant = -16 // here i'm expanding the width by setting constant of my Textfield
self.constraint1.constant = -16
UIView.animateWithDuration(duration) {
self.fullnameTextField.layoutIfNeeded()
}
}
私のNSLogエラー:
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:0x155e77fb0 UITextField:0x155d85e40.trailing == UIView:0x155e46800.trailingMargin>",
"<NSLayoutConstraint:0x1546b02b0 UITextField:0x155d85e40.leading == UIView:0x155e46800.leadingMargin - 16>",
"<NSLayoutConstraint:0x1546447e0 UITextField:0x155d85e40.centerX == UIView:0x155e46800.centerX>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x1546447e0 UITextField:0x155d85e40.centerX == UIView:0x155e46800.centerX>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
ここで私が制約に
を設定してる私のストーリーボードは、奇妙に私は別のビューコントローラ上で同じことをやって、そのここではそこではなく、働いているということですです私は彼らが正しいすべての制約をチェックし、そのViewController(上記は正常に動作している)にもNSLogのエラーが表示されます
誰かが何か手がかりが何も間違っていますか?私は私のViewControllerのそののでイライラ
コードを教えてくださいhttp://pastebin.com/BvfEvzPE
先頭の制約は '16'のみで、末尾は' -16'です。 –
@DipenPanchasaraちょっとあなたの答えは、トリックをした –
ありがとう。ハッピーコーディング:) –