ok У меня есть эта странная проблема (потому что я никогда не видел таких ошибок раньше), у меня есть текстовое поле в моем представлении, и я расширяю его ширину с помощью анимации от обе стороны (Скользящие и ведущий), но проблема в том, это его единственное расширение с одной стороны (либо задней или передней)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.
вот мой, где я устанавливаю ограничения
странно, что я делаю то же самое на другой контроллер с видом и его работы там, но не здесь раскадровка, Я проверил каждое ограничение, которое они правильные, и что ошибка NSLog также появляется в этом ViewController (где выше работает нормально)
У кого-нибудь есть какие-то сведения, что здесь не так? пожалуйста, дайте мне знать его так расстраивает
код моего ViewController http://pastebin.com/BvfEvzPE
Ваше ведущее ограничение должно быть только «16», тогда как трейлинг будет «-16». –
@ DipenPanchasara эй человек ваш ответ сделал трюк –
спасибо. Счастливое кодирование :) –