coming the issues of auto layouts in the console - ios

hai i am trying the auto layout concepts,here i am getting the more issues in console,can anybody tell me how to solve this
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)
(
"<NSLayoutConstraint:0x7faeb358e200 H:|-(0)-[UIImageView:0x7faeb35834b0] (Names: '|':UIView:0x7faeb35832c0 )>",
"<NSLayoutConstraint:0x7faeb358e390 UILabel:0x7faeb358a1e0'Welcome to'.leading == UIView:0x7faeb35832c0.leadingMargin + 46>",
"<NSLayoutConstraint:0x7faeb358e4d0 UIImageView:0x7faeb3585ab0.leading == UILabel:0x7faeb358a1e0'Welcome to'.leading + 28>",
"<NSLayoutConstraint:0x7faeb358e520 UIImageView:0x7faeb3585ab0.leading == UIImageView:0x7faeb35834b0.leading + 90>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7faeb358e390 UILabel:0x7faeb358a1e0'Welcome to'.leading == UIView:0x7faeb35832c0.leadingMargin + 46>
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.
2014-12-23 16:30:57.326 Aaja[11268:148329] Unable to simultaneously satisfy constraints.
this issue is coming 10 times repeatedly

From this error you have...
|[ImageView-b0]
|-46-[Label-e0]
-(+28)-[ImageView-b0]
[Label-e0]
i.e. |-74-[ImageView-b0] //this conflicts the first one.
[ImageView-b0]
-(+90)-[ImageView-b0]
These are the different constraints shown in the error.
It looks like a bit of a mess. You have zero spacing between the image view and the super view. You then have 46 spacing between the label and the super view.
But then you try to align the left edges of the label and image view with a difference of 28.
You then have an additional problem which I don't quite understand. You are telling it the align the leading edge of the image view with itself but with a difference. This will never be able to work.
It is basically telling you that it can't make all of the constraints work because they conflict each other and so it has to break some of them.

Related

UITextField not showing up on View Controller

I've added a simple UITextView and i placed it where i want to in the storyboard, then i click on add missing contraints/reset to suggested and it doesn't show up on the screen when i run it, i don't know why its not working
this is what i get in the debugger.
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)
(
"<_UILayoutSupportConstraint:0x15ed61540 V:[_UILayoutGuide:0x15eee5f50(20)]>",
"<_UILayoutSupportConstraint:0x15ed0c500 V:|-(0)-[_UILayoutGuide:0x15eee5f50] (Names: '|':UIView:0x15eee5df0 )>",
"",
"",
"" )
Will attempt to recover by breaking constraint
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in may also be helpful.
Using the "add suggested constraint" is usually not a good idea. I really recommend that you study more about auto-layout and adaptive layout. I'd need to know exactly how you want to position and size you UITextField to determine what is the conflicting constraint for your case, it would be important to know what other views you have in your view controller that might be affecting the text field.

iOS, Animating view's constraints causes error "Unable to simultaneously satisfy constraints"

I am attemptin to animate one of my container view's constraints. In IB, the the view is constrained fine without errors or warnings. When I call these methods in viewDidLoad, to change the views y coordinate like so:
self.queueContainerYConst.constant += 550;
[self.view layoutIfNeeded];
I get the message for "unable to satisfy constraints...". While running the app, my animations and UI look fine, everything is appears to be constrained properly. Here is the entire message I get in the console.
2015-05-03 14:17:52.668 Streamacy[15914:3333195] 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)
(
"<NSLayoutConstraint:0x155a95c0 V:|-(614)-[UIView:0x155a83a0] (Names: '|':UIView:0x155a91b0 )>",
"<NSLayoutConstraint:0x155a95f0 V:[UIView:0x155a83a0]-(0)-| (Names: '|':UIView:0x155a91b0 )>",
"<NSLayoutConstraint:0x155af080 'UIView-Encapsulated-Layout-Height' V:[UIView:0x155a91b0(568)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x155a95f0 V:[UIView:0x155a83a0]-(0)-| (Names: '|':UIView:0x155a91b0 )>
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.
2015-05-03 14:17:52.684 Streamacy[15914:3333195] 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)
(
"<NSLayoutConstraint:0x1566a2a0 UIView:0x156a1900.width == UIView:0x156a1900.height>",
"<NSLayoutConstraint:0x156a9000 V:[UIView:0x156a1900]-(32)-[UIProgressView:0x15688f30]>",
"<NSLayoutConstraint:0x156a0df0 V:[UIProgressView:0x15688f30]-(11)-[MarqueeLabel:0x156a7360'Awake']>",
"<NSLayoutConstraint:0x156a0eb0 UIView:0x1569dd90.trailingMargin == UIView:0x156a1900.trailing + 99>",
"<NSLayoutConstraint:0x156a0f10 UIView:0x156a1900.leading == UIView:0x1569dd90.leadingMargin + 99>",
"<NSLayoutConstraint:0x156a0f40 UIView:0x156a1900.top == UIView:0x1569dd90.topMargin - 46>",
"<NSLayoutConstraint:0x156a92f0 V:[UILabel:0x156a6ea0'Tycho']-(17)-[UITableView:0x1587a000]>",
"<NSLayoutConstraint:0x156a93b0 V:[MarqueeLabel:0x156a7360'Awake']-(2)-[UILabel:0x156a6ea0'Tycho']>",
"<NSLayoutConstraint:0x156a94d0 V:[UITableView:0x1587a000]-(0)-[_UILayoutGuide:0x156a8b20]>",
"<_UILayoutSupportConstraint:0x156a4cf0 V:[_UILayoutGuide:0x156a8b20(0)]>",
"<_UILayoutSupportConstraint:0x156a4810 _UILayoutGuide:0x156a8b20.bottom == UIView:0x1569dd90.bottom>",
"<NSLayoutConstraint:0x156b6070 'UIView-Encapsulated-Layout-Width' H:[UIView:0x1569dd90(320)]>",
"<NSLayoutConstraint:0x156b60a0 'UIView-Encapsulated-Layout-Height' V:[UIView:0x1569dd90(0)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x1566a2a0 UIView:0x156a1900.width == UIView:0x156a1900.height>
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.
2015-05-03 14:17:52.688 Streamacy[15914:3333195] 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)
(
"<NSLayoutConstraint:0x156a9000 V:[UIView:0x156a1900]-(32)-[UIProgressView:0x15688f30]>",
"<NSLayoutConstraint:0x156a0df0 V:[UIProgressView:0x15688f30]-(11)-[MarqueeLabel:0x156a7360'Awake']>",
"<NSLayoutConstraint:0x156a0f40 UIView:0x156a1900.top == UIView:0x1569dd90.topMargin - 46>",
"<NSLayoutConstraint:0x156a92f0 V:[UILabel:0x156a6ea0'Tycho']-(17)-[UITableView:0x1587a000]>",
"<NSLayoutConstraint:0x156a93b0 V:[MarqueeLabel:0x156a7360'Awake']-(2)-[UILabel:0x156a6ea0'Tycho']>",
"<NSLayoutConstraint:0x156a94d0 V:[UITableView:0x1587a000]-(0)-[_UILayoutGuide:0x156a8b20]>",
"<_UILayoutSupportConstraint:0x156a4cf0 V:[_UILayoutGuide:0x156a8b20(0)]>",
"<_UILayoutSupportConstraint:0x156a4810 _UILayoutGuide:0x156a8b20.bottom == UIView:0x1569dd90.bottom>",
"<NSLayoutConstraint:0x156b60a0 'UIView-Encapsulated-Layout-Height' V:[UIView:0x1569dd90(0)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x156a9000 V:[UIView:0x156a1900]-(32)-[UIProgressView:0x15688f30]>
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.
It appears that everything inside my container view gets misplaced, why?. Am I animating/changing my view improperly?
You're view is over constrained. You have a constraint of 614 to the top and 0 to the bottom of its superview, but the height of that view is 568, so those numbers don't add up. It would be better to only have one of those vertical constraints and a fixed hight for your view if that works for your purposes (that "fixed" height could be made relative to the superview's height if you ned it to adjust for different screen sizes).

What are these warnings in my console?

I am having the following error in my console.I don't know what are they.
2015-03-24 13:57:43.213 automobile[5454:530574] 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)
(
"<NSLayoutConstraint:0x174284880 V:[_UILayoutGuide:0x1741b8e20]-(238)-[UIButton:0x12ee424c0'Retry']>",
"<NSLayoutConstraint:0x174284740 V:[UIButton:0x12ee424c0'Retry']-(236)-[_UILayoutGuide:0x1741b8f00]>",
"<_UILayoutSupportConstraint:0x1740aeb80 V:[_UILayoutGuide:0x1741b8e20(50.66)]>",
"<_UILayoutSupportConstraint:0x1740aebe0 V:|-(0)-[_UILayoutGuide:0x1741b8e20] (Names: '|':UIView:0x174185bd0 )>",
"<_UILayoutSupportConstraint:0x1740aee80 V:[_UILayoutGuide:0x1741b8f00(0)]>",
"<_UILayoutSupportConstraint:0x1740aee20 _UILayoutGuide:0x1741b8f00.bottom == UIView:0x174185bd0.bottom>",
"<NSLayoutConstraint:0x174289d30 'UIView-Encapsulated-Layout-Height' V:[UIView:0x174185bd0(375)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x174284880 V:[_UILayoutGuide:0x1741b8e20]-(238)-[UIButton:0x12ee424c0'Retry']>
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.
Anyone who know this?Any Help?
It seems you have conflicting constraints on your views.
If you are using Interface Builder, I suggest your click on the Red or Yellow arrows in your VC scene and Xcode should give you more details as to what constraints are causing the issue.
You can see here http://i.stack.imgur.com/5lbp8.png and here http://i.stack.imgur.com/qjvFL.png how this should appear in Xcode.
I suggest you start by reconsidering the constraints and try to keep the minimum that satisfy your layout.
I hope this helps

Auto layout unable to satisfy constraints when activating a segue

I have a custom table view cell with constraints suggested by Auto Layout. In the storyboard all the constraints are marked with blue lines indicating that they have no errors. The tableview launches fine and the layout works but as soon as I hit the cell to activate a segue I get this:
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.
I have not added any code that adds or removes constraints to my layout. All the constraints were auto-added by Auto layout.
The error only shows up when I hit the cell which activates a segue to take the user to the next view. When I hit the back button, the tableview returns but without any constraints.
The segue is set as Show(e.g. Push) in the Attributes Inspector.
Here's the rest of the message:
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSLayoutConstraint:0x7ff1c276fec0 UIImageView:0x7ff1c2496b40.top == UITableViewCellContentView:0x7ff1c2496630.topMargin + 15>",
"<NSLayoutConstraint:0x7ff1c276ff10 UIImageView:0x7ff1c2496b40.centerY == UITableViewCellContentView:0x7ff1c2496630.centerY>",
"<NSLayoutConstraint:0x7ff1c24c9a70 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7ff1c2496630(43.5)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7ff1c276ff10 UIImageView:0x7ff1c2496b40.centerY == UITableViewCellContentView:0x7ff1c2496630.centerY>
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.
2015-01-06 11:35:58.645 FitLift[4174:130902] 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)
(
"<NSLayoutConstraint:0x7ff1c2494c00 UIImageView:0x7ff1c277c070.top == UITableViewCellContentView:0x7ff1c277bfa0.topMargin + 15>",
"<NSLayoutConstraint:0x7ff1c24a3360 UIImageView:0x7ff1c277c070.centerY == UITableViewCellContentView:0x7ff1c277bfa0.centerY>",
"<NSLayoutConstraint:0x7ff1c24b7010 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7ff1c277bfa0(43.5)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7ff1c24a3360 UIImageView:0x7ff1c277c070.centerY == UITableViewCellContentView:0x7ff1c277bfa0.centerY>
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.
2015-01-06 11:35:58.646 FitLift[4174:130902] 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)
(
"<NSLayoutConstraint:0x7ff1c24c4390 UIImageView:0x7ff1c24bc880.top == UITableViewCellContentView:0x7ff1c24bc3d0.topMargin + 15>",
"<NSLayoutConstraint:0x7ff1c24c43e0 UIImageView:0x7ff1c24bc880.centerY == UITableViewCellContentView:0x7ff1c24bc3d0.centerY>",
"<NSLayoutConstraint:0x7ff1c24c7880 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7ff1c24bc3d0(43.5)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7ff1c24c43e0 UIImageView:0x7ff1c24bc880.centerY == UITableViewCellContentView:0x7ff1c24bc3d0.centerY>
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.
From the error log, it seems the two conflicting constraints are the image view's top constraint and centerY constraint. Choose only one--iOS is confused what value to assign to the image view's y-coordinate. Do you want the image view to be a certain distance from the top, or to be a certain distance from the superview's vertical center?
As a general rule, if you want your UI to look the way you want to, DO NOT let Xcode auto-add the constraints for you. Define it yourself. We can't really help you here because we don't know the other constraints that Xcode added but don't conflict.
Try lowering one of your vertical constraint priorities to 999 or less.
"<NSLayoutConstraint:0x174091d00 V:|-(10)-[UILabel:0x14562e580'This'] (Names: '|':UITableViewCellContentView:0x17418d5b0 )>",
"<NSLayoutConstraint:0x174091e40 UITableViewCellContentView:0x17418d5b0.bottomMargin >= UILabel:0x14562e580'This'.bottom + 200>",
"<NSLayoutConstraint:0x17408c940 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x17418d5b0(43.5)]>"
I was getting this, notice the last one, encapsulated height 43.5, I'm guessing its a default height, and if your vertical constraints don't fit within that 43.5, the error is thrown. I'm still uncertain how the self sizing cells work, but lowering priorities silenced the warning. I tested a cell shorter than the 43.5 and it also silenced it.
I had a similar problem and it was fixed by setting the tableview's estimatedRowHeight. The default 43.5 wasn't enough to even cover the fixed number of points I set (e.g., my top label in the cell was 10 points from the top of the cell, the bottom label was 10 points from the bottom, and space between rows of labels, etc.)

Issue in setting five horizontal buttons in auto layout

I am using auto layout to create five buttons at the bottom of the view.The layout looks like below where the brown colour shows the spacer view and number shows the buttons I am using.
When I set the constraints I find that for iPhone the views are not resizing and we are missing the buttons as in the below screen shot. The buttons are hidden and are not resizing.
When I run it on iPad the last spacer view is resizing and other
Also, there are some errors in the logs that i am unable to understand can see below.
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)
(
"<NSLayoutConstraint:0x7f8673d62320 H:[UIView:0x7f8673f08c40]-(398)-| (Names: '|':UIView:0x7f8673f08970 )>",
"<NSLayoutConstraint:0x7f8673d623c0 UIView:0x7f8673f08c40.leading == UIView:0x7f8673f08970.leadingMargin + 86>",
"<NSLayoutConstraint:0x7f8673d7c1e0 'UIView-Encapsulated-Layout-Width' H:[UIView:0x7f8673f08970(414)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7f8673d623c0 UIView:0x7f8673f08c40.leading == UIView:0x7f8673f08970.leadingMargin + 86>
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.
2014-12-29 13:00:54.932 Browser_Test[2480:60168] 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)
(
"<NSLayoutConstraint:0x7f8673d62b60 H:|-(446)-[UIView:0x7f8673d48640] (Names: '|':UIView:0x7f8673f08970 )>",
"<NSLayoutConstraint:0x7f8673d62bb0 UIView:0x7f8673f08970.trailingMargin == UIButton:0x7f8673d53450'5'.trailing + 8>",
"<NSLayoutConstraint:0x7f8673d62c00 H:[UIView:0x7f8673d48640]-(0)-[UIButton:0x7f8673d53450'5']>",
"<NSLayoutConstraint:0x7f8673d7c1e0 'UIView-Encapsulated-Layout-Width' H:[UIView:0x7f8673f08970(414)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7f8673d62c00 H:[UIView:0x7f8673d48640]-(0)-[UIButton:0x7f8673d53450'5']>
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.
So can please some body suggest me whats getting wrong.
Edit:1
Edit:2
The buttons should all have pinned width. Button 1 should be set leading to the superview and trailing to spacer 1. Button 5 should be set leading to spacer 4 and trailing to the superview. Other buttons should be set leading and trailing to the adjacent spacers. All of the spacers should be set to have equal width to spacer 1.
Now, autolayout will resize the spacer views, all at the same time, to fill the available space as they don't have a specified width but the buttons do and they also have set edges (for buttons 1 and 5).

Resources