Higher Segmented Control for ios 7.1 - ios

I'm using this code to change the Segmented Control height. It works perfect for 8.0 and newest versions but not with lower like 7.1. Do you know any other way to change it? Thanks!
NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:segmentedControlShortcuts
attribute:NSLayoutAttributeHeight
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1
constant:50];
That's the error that i receive in 7.1:
"2015-04-09 12:10:06.626 KMetrix[546:607] 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)
(
"",
""
)
Will attempt to recover by breaking constraint
Break on objc_exception_throw to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in may also be helpful."

Try this. Tested in both iOS7 & iOS8 -
NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:self.mySegmentCtrl
attribute:NSLayoutAttributeHeight
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1
constant:50];
[self.mySegmentCtrl addConstraint:constraint];
Check screenshots it works in both iOS7 & iOS8 -

Related

iOS Auto Layout conundrum - fails on initial view but works after rotating the phone

I am new to iOS programming and working on a legacy app that is written in Objective C and C++. It has not had constraints up until now and I am tasked with fixing a bug that everyone here agrees is best solved with constraints and auto layout. None of the screens have been built with Interface Builder and switching to Interface builder is outside the scope of my current task.
My problem as stated in the subject is that I have a screen which spews an error when it is first opened:
2017-06-09 07:35:58.474149 Mobile[2132:1766896] [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:0x1899dd30 V:|-(50)-[TPKeyboardAvoidingScrollView:0x17ba9a00] (active, names: '|':UIScrollView:0x17f88200 )>",
"<NSLayoutConstraint:0x1899e310 V:|-(0)-[TPKeyboardAvoidingScrollView:0x17ba9a00] (active, names: '|':UIScrollView:0x17f88200 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x1899dd30 V:|-(50)-[TPKeyboardAvoidingScrollView:0x17ba9a00] (active, names: '|':UIScrollView:0x17f88200 )>
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.
If I ignore this and simply rotate the screen to landscape, I get no more error messages and the screen displays properly. I can then rotate back to portrait and the screen is still displayed correctly with no error messages.
I am convinced that this is an issue with my constraints but I cannot figure out what I have done wrong.
UIScrollView * scrView;
for (UIView* view in scrollView.subviews) {
if ([view isKindOfClass:[TPKeyboardAvoidingScrollView class]]) {
scrView = (UIScrollView *)view;
[scrollView setContentSize:scrView.contentSize];
break;
}
}
[scrView removeConstraints:scrView.constraints];
scrView.translatesAutoresizingMaskIntoConstraints = NO;
[scrollView addConstraint:[NSLayoutConstraint
constraintWithItem:scrView
attribute:NSLayoutAttributeTop
relatedBy:NSLayoutRelationEqual
toItem:scrollView
attribute:NSLayoutAttributeTop
multiplier:1.0
constant:0]];
[scrollView addConstraint:[NSLayoutConstraint
constraintWithItem:scrView
attribute:NSLayoutAttributeBottom
relatedBy:NSLayoutRelationEqual
toItem:scrollView
attribute:NSLayoutAttributeBottom
multiplier:1.0
constant:0]];
[scrollView addConstraint:[NSLayoutConstraint
constraintWithItem:scrView
attribute:NSLayoutAttributeLeft
relatedBy:NSLayoutRelationEqual
toItem:scrollView
attribute:NSLayoutAttributeLeft
multiplier:1.0
constant:0]];
[scrollView addConstraint:[NSLayoutConstraint
constraintWithItem:scrView
attribute:NSLayoutAttributeRight
relatedBy:NSLayoutRelationEqual
toItem:scrollView
attribute:NSLayoutAttributeRight
multiplier:1.0
constant:0]];
I am also sure that part of my problem is that I am trying to shoe horn new constraints into an app that mostly uses programmatically set frames from pre-iOS 7.
Can anybody point out my error from the code snippet I have posted or at least point me to a good resources for diagnosing the error myself?
Do you add constraints only in this code snippet?
The following message means that the scrollView has two conflicting constraints. One of them trying to set 50pt space to top, another trying to add 0pt space to top. And the system doesn't know which constraint to use.
"<NSLayoutConstraint:0x1899dd30 V:|-(50)-[TPKeyboardAvoidingScrollView:0x17ba9a00] (active, names: '|':UIScrollView:0x17f88200 )>",
"<NSLayoutConstraint:0x1899e310 V:|-(0)-[TPKeyboardAvoidingScrollView:0x17ba9a00] (active, names: '|':UIScrollView:0x17f88200 )>"
Try to use
[scrollView layoutIfNeeded]
after removing constraints.

UIImageView repeats showing in another cells

I dynamically add an UIImageView (as thumbnail) and its NSLayoutConstraints in my UIView which in the cell of a table. I have two problems about this.
After an image view added, if the user inserts text to this table still an image is being shown. I mean, instead of text table prints one more image. However, if I stop and re-run the application, this time text is shown as it should be. Still, if I write a text picture is coming. Why and what should I do?
I set image and its constraints like this:
-(void)setThumbnail:(UIImageView)imageView {
[self.messageView addSubview:imageView];
NSLayoutConstraint *leadingOfThumbnail = [NSLayoutConstraint constraintWithItem:imageView attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:self.messageView attribute:NSLayoutAttributeLeading multiplier:1.0 constant:8.f];
NSLayoutConstraint *trailingOfThumbnail = [NSLayoutConstraint constraintWithItem:imageView attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:self.messageView attribute:NSLayoutAttributeTrailing multiplier:1.0 constant:-8.f];
NSLayoutConstraint *topOfThumbnail = [NSLayoutConstraint constraintWithItem:imageView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.messageView attribute:NSLayoutAttributeTop multiplier:1.0 constant:8.f];
NSLayoutConstraint *bottomOfThumbnail = [NSLayoutConstraint constraintWithItem:imageView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.messageView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-8.f];
[self.messageView addConstraint:leadingOfThumbnail];
[self.messageView addConstraint:trailingOfThumbnail];
[self.messageView addConstraint:topOfThumbnail];
[self.messageView addConstraint:bottomOfThumbnail];
[self.messageView setTranslatesAutoresizingMaskIntoConstraints:NO];
[self.messageView removeConstraints:[self.messageTextLabel constraints]];
}
And while loading, I get a constraint error. It says:
2016-10-07 09:35:32.532 application[3733:2922397] 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) (
"NSAutoresizingMaskLayoutConstraint:0x1281474d0 h=--& v=--& UIImageView:0x126d7e020.midY == + 100",
"NSAutoresizingMaskLayoutConstraint:0x128147520 h=--& v=--& V:[UIImageView:0x126d7e020(200)]",
"NSLayoutConstraint:0x126d6c880 V:|-(8)-[UIImageView:0x126d7e020] (Names: '|':UIView:0x1281480d0 )" )
Will attempt to recover by breaking constraint NSLayoutConstraint:0x126d6c880 V:|-(8)-[UIImageView:0x126d7e020] (Names: '|':UIView:0x1281480d0 )
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.
I checked, leading and top constrains set by me causes this error. Already they are not working correct. My image is 200 * 200, thus it does not need height and width constraint. I only want 8 pt leading, trailing, top, bottom from message view. What is the problem?
Thank you.
Explanation edit for first question: Table puts UIImageView randomly, multiple cells - not as it should be.
You may want to implement the prepareForReuse method and do some cleanup there, set the imageView to nil and remove it from the subview here.
This method gets called when your cell is dequeued and about to be reused in the tableview.
For the first issue, you can simply set cell image to nil after dequeing from tableview.
For the second issue, after ImageView initialization add this line, to avoid that autoresizingmask is translated to constraints:
imageView.translatesAutoresizingMaskIntoConstraints = false
I believe that your problem is because of the dequeCell functionality. UITbableView recycle cells. So if you place an image in one cell, there is a chance that it will appear in another cell.
To solve this, you need to place some conditions in your cellForRowAtIndexPath.
These conditions would check if you want text in your current cell or image or both.
If it only needs text, you need to remove the image from that cell.
If you still face problems, please share your cellForRowAtIndexPath code.

How to add Constraint programmatically in objective c

I want to add constraint programmatically and I use below code to add TOP and LEFT constraint.
NSLayoutConstraint *top = [NSLayoutConstraint constraintWithItem:label1
attribute:NSLayoutAttributeTop
relatedBy:NSLayoutRelationEqual
toItem:self.view
attribute:NSLayoutAttributeTop
multiplier:1
constant:110];
NSLayoutConstraint *left = [NSLayoutConstraint constraintWithItem:label1
attribute:NSLayoutAttributeLeading
relatedBy:NSLayoutRelationEqual
toItem:self.view
attribute:NSLayoutAttributeLeading
multiplier:1
constant:10];
lable1 is added in my view controller. When I add this two constraint in the view like
[self.view addConstraint:top];
[self.view addConstraint:left];
It gives the error in the consol and constraint does not affect the lable.
2016-02-09 19:36:59.824 testinMRC[99160:313382] 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:0x7fa5c8738610 V:|-(110)-[UILabel:0x7fa5c8626940'Label'] (Names: '|':UIView:0x7fa5c86267b0 )>",
"<NSIBPrototypingLayoutConstraint:0x7fa5c8628a70 'IB auto generated at build time for view with fixed frame' V:|-(88)-[UILabel:0x7fa5c8626940'Label'] (Names: '|':UIView:0x7fa5c86267b0 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fa5c8738610 V:|-(110)-[UILabel:0x7fa5c8626940'Label'] (Names: '|':UIView:0x7fa5c86267b0 )>
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.
2016-02-09 19:36:59.889 testinMRC[99160:313382] 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:0x7fa5c87334b0 H:|-(10)-[UILabel:0x7fa5c8626940'Label'] (Names: '|':UIView:0x7fa5c86267b0 )>",
"<NSIBPrototypingLayoutConstraint:0x7fa5c86285c0 'IB auto generated at build time for view with fixed frame' H:|-(188)-[UILabel:0x7fa5c8626940'Label'](LTR) (Names: '|':UIView:0x7fa5c86267b0 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fa5c87334b0 H:|-(10)-[UILabel:0x7fa5c8626940'Label'] (Names: '|':UIView:0x7fa5c86267b0 )>
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.
Can anyone tell me why this error come?
Help me to short out the solution
In your case error clearly states that you have conflicting constraints for your view. Probably because you a trying to add constraints to the view that already has some from Interface Builder. Even if you didn't set up any constrains explicitly IB does provide them for you when it detects that some are missing.
I see in comments you've mentioned that you want to do everything programmatically.In that case take a look at piece of code:
- (void)viewDidLoad {
[super viewDidLoad];
UIView *view = [UIView new];
view.backgroundColor = [UIColor redColor];
[view setTranslatesAutoresizingMaskIntoConstraints:NO];
[self.view addSubview:view];
NSLayoutConstraint *left = [NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1 constant:100];
NSLayoutConstraint *top = [NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1 constant:100];
NSLayoutConstraint *height = [NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:50];
NSLayoutConstraint *width = [NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:50];
[self.view addConstraints:#[left, top]];
[view addConstraints:#[height, width]];
}
It's pretty self-explanatory. As you can see I had to add width and height constraints to the view, because only left and top doesn't fully describe it's position.
Result:
I encourage you to try out Visual Format Language. Same result can be achieved with much less code. This code leads to the very same result:
NSArray *horizontal = [NSLayoutConstraint constraintsWithVisualFormat:#"|-100-[view(50)]" options:0 metrics:nil views:#{#"view" : view}];
NSArray *vertical = [NSLayoutConstraint constraintsWithVisualFormat:#"V:|-100-[view(50)]" options:0 metrics:nil views:#{#"view" : view}];
[self.view addConstraints:vertical];
[self.view addConstraints:horizontal];
Let me know if this helped. Cheers.
The problem is not your code, it is the IB auto generated at build time for view with fixed frame message:
Interface Builder automatically generates constraints for you if you don't add them yourself.
You could avoid it by either
Select the nib or storyboard in the Project Navigator, go to the File Inspector and uncheck Use Auto Layout.
or
Add some constraints in Interface Builder and set them to remove at build time.
It looks like you have conflicting layout constraints. A constraint was most likely set up in storyboard and you are trying to add a constraint programmatically that directly conflicts with it.
It looks like you are trying to move a UIView out of the way after an action occurs. I.E press a button and move a happy face picture from the middle of the screen to the top left corner.
Adding and removing constraints directly in code can be a HUGE headache with code bloat, unit testing and warnings filling up your console.
It might be a better idea to create the main UIView in storyboard and have a hidden placeholder UIView that holds all the constraints you want the UIView to have after you press the button. Then you can switch out all the constraints programmatically for those UIViews. So the view you want to modify will have the position, width and height of the placeholder and the place holder will have the position and height of the view you want to modify.
This way you will never have this error while changing the layout constraints programmatically because any errors will be caught by the storyboard.
There's some open source that does this for you in one or two lines of code. (There's some youtube video tutorials in the docs too) https://cocoapods.org/pods/SBP
After installing the cocoapod, your code would look something like this
this would be code inside the view controller with the UIView you want to modify and the placeholder UIView
//UIView* viewBeforeChange
//UIView* hiddenViewAfterChange
[self switchViewConst:viewBeforeChange secondView:hiddenViewAfterChange];

Setting the NSLayoutAttributeLeading Space to Superview programmatically with some warnings

I am bringing an AdBannerView to the bottom of my app and I'm creating this programmatically because of the use of shared banners (rather than creating it in Storyboard). My app works in Portrait and Landscape mode and so in my viewWillAppear, I am setting the frame for the AdBannerView and I've also tried for the first time to work with AutoLayout programmatically but I'm having some issues.
I created the AdBannerView as a test in Storyboard and managed to apply the Leading Spaces to Superview, Trailing Spaces to Superview and Bottom Space to Superview constraints on the AdBannerView and so when I rotated the device, it would show up on the bottom in both Landscape and Portrait.
However, when doing the AutoLayout programatically, I'm not getting the same results.
Here's my code:
[self.adBanner setFrame:CGRectMake(0, [[UIScreen mainScreen] bounds].size.height-100, 320, 50)];
[self.view addSubview:self.adBanner];
NSLayoutConstraint *myConstraint =[NSLayoutConstraint
constraintWithItem:self.adBanner
attribute:NSLayoutAttributeLeading
relatedBy:NSLayoutRelationEqual
toItem:self.view
attribute:NSLayoutAttributeTrailing
multiplier:1.0
constant:0];
[self.view addConstraint:myConstraint];
myConstraint =[NSLayoutConstraint constraintWithItem:self.adBanner
attribute:NSLayoutAttributeTrailing
relatedBy:NSLayoutRelationEqual
toItem:self.view
attribute:NSLayoutAttributeLeading
multiplier:1
constant:0];
[self.view addConstraint:myConstraint];
myConstraint =[NSLayoutConstraint constraintWithItem:self.adBanner
attribute:NSLayoutAttributeBottom
relatedBy:NSLayoutRelationEqual
toItem:self.view
attribute:NSLayoutAttributeBaseline
multiplier:1
constant:0];
[self.view addConstraint:myConstraint];
What I'm getting in the console is:
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:0x7fcb017020f0 ADBannerView:0x7fcb014c1860.bottom == UIView:0x7fcb014f9f70.lastBaseline>",
"<NSAutoresizingMaskLayoutConstraint:0x7fcb01624280 h=--& v=--& ADBannerView:0x7fcb014c1860.midY == + 957>",
"<NSAutoresizingMaskLayoutConstraint:0x7fcb016242f0 h=--& v=--& V:[ADBannerView:0x7fcb014c1860(66)]>",
"<NSLayoutConstraint:0x7fcb017039b0 'UIView-Encapsulated-Layout-Height' V:[UIView:0x7fcb014f9f70(768)]>",
"<NSAutoresizingMaskLayoutConstraint:0x7fcb014fa8a0 h=--& v=--& 'UIView-Encapsulated-Layout-Top' V:|-(0)-[UIView:0x7fcb014f9f70] (Names: '|':UIViewControllerWrapperView:0x7fcb01619da0 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fcb017020f0 ADBannerView:0x7fcb014c1860.bottom == UIView:0x7fcb014f9f70.lastBaseline>
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.
The device rotates but in Landscape mode, the AdBannerView is not shown, probably because it has been moved off-screen.
I've been through a number of tutorials on AutoLayout programatically and I honestly just don't get it.
Question:
Is there a way I can pin my AdBannerView to the left edge of the screen (Leading), to the right edge of the screen (Trailing) and to the Bottom of the screen (Bottom) programatically, so that when I rotate my iPhone/iPad, the AdBannerView shows there?
This app is iOS 7 and iOS 8 compatible.
First, you need to call [self.adBanner setTranslatesAutoresizingMasksIntoConstraints:NO]
Second, you will still need either a top offset constraint or a height constraint for the adBanner view.
Also, since you are using auto layout, you don't need to set the frame anymore, that will be done automatically by the layouting system.
Let me know if you need more help :)
You still need the height constraint. You can use something like:
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:#"V:[view(==50)]" options:0 metrics:nil views:#{ #"view": self.adBanner }]];
You can call [self.view layoutIfNeeded] after you have setup all your constraints. Print out the frame for the adBanner, after the method call, for debugging purposes, to make sure all is how you want it.

iOS Auto Layout issue

I'm trying to make constraints programmatically. I have textField and button created in IB. Here is the code:
UIView *superview = self.view;
self.button.translatesAutoresizingMaskIntoConstraints = NO;
self.textField.translatesAutoresizingMaskIntoConstraints = NO;
NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:self.textField
attribute:NSLayoutAttributeCenterY
relatedBy:NSLayoutRelationEqual
toItem:superview
attribute:NSLayoutAttributeCenterY
multiplier:1.0f
constant:0];
[superview addConstraint:constraint];
constraint = [NSLayoutConstraint constraintWithItem:self.textField
attribute:NSLayoutAttributeCenterX
relatedBy:NSLayoutRelationEqual
toItem:superview
attribute:NSLayoutAttributeCenterX
multiplier:1.0f
constant:0];
[superview addConstraint:constraint];
constraint =[NSLayoutConstraint constraintWithItem:self.button
attribute:NSLayoutAttributeTrailing
relatedBy:NSLayoutRelationEqual
toItem:self.textField
attribute:NSLayoutAttributeLeading
multiplier:1
constant:-10];
[superview addConstraint:constraint];
constraint =[NSLayoutConstraint constraintWithItem:self.button
attribute:NSLayoutAttributeBaseline
relatedBy:NSLayoutRelationEqual
toItem:self.textField
attribute:NSLayoutAttributeBaseline
multiplier:1
constant:0];
[superview addConstraint:constraint];
And after running I have this issue:
Constraints also have no effect on views.
What am I doing wrong?
First in the storyboard editor select the view controller you want to change then, in the constraint editor, select "ADD missing constraints in view controller"
Select an elment that you'd like to modify at runtime by remomiving and adding new constraint, in the object inspector panel select each constraints and edit it by checking the box "placeholder: remove at build time".
This is a way to say to storyboard editor that you are fine with the constraint ant it should not apply or complain about an insufficient constraints situation.
Constraints flagged are removed at runtime, so you should provide you own constraint and is better if you do in the right place. Ovverride -updateViewConstraints in the view controller and remember to call super and add you new constraints.
You have three auto-generated constraints "IB auto generated at build time for view with fixed frame". These conflict with the ones you make yourself. Probably, you have set fixed size properties on the text field and button in Interface Builder. Possibly, you have a fixed width on your button, and that conflicts with the trailing constraint.
Combining IB with code constraints can be tricky. I have found it is often easier to design things only in IB or only in code to avoid conflicts like these, although combining the two is perfectly viable.
For a good explanation on what NSIBPrototypingLayoutConstraint is, have a look at this SO answer:
Trouble with AutoLayout on UITableViewCell

Resources