I was recently having an issue with animating a UITableView. It turned out that the issue was being caused by auto layout constraints. I disabled auto layout for the UITableView by using the following code:
myTableView.translatesAutoresizingMaskIntoConstraints = YES;
This solved the issue but now every time I animate the UITableView I break the constraints placed on the frame and get the following warning.
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)
(
"<NSIBPrototypingLayoutConstraint:0x170a95db0 'IB auto generated at build time for view with fixed frame' V:|-(538)-[UITableView:0x140330c00] (Names: '|':UIView:0x170199640 )>",
"<NSIBPrototypingLayoutConstraint:0x170c9d010 'IB auto generated at build time for view with fixed frame' V:[UITableView:0x140330c00(220)]>",
"<NSAutoresizingMaskLayoutConstraint:0x175e850a0 h=--& v=--& UITableView:0x140330c00.midY == + 458>",
"<NSAutoresizingMaskLayoutConstraint:0x175c97b10 h=-&- v=-&- 'UIView-Encapsulated-Layout-Top' V:|-(0)-[UIView:0x170199640] (Names: '|':UITransitionView:0x143942020 )>"
)
Will attempt to recover by breaking constraint
<NSIBPrototypingLayoutConstraint:0x170a95db0 'IB auto generated at build time for view with fixed frame' V:|-(538)-[UITableView:0x140330c00] (Names: '|':UIView:0x170199640 )>
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 need to use translatesAutoresizingMaskIntoConstraints to make my animation work, but would like to get rid of this pesky warning. Is there any way to eliminate this warning without removing translatesAutoresizingMaskIntoConstraints = YES?
Edit in response to comments:
So the UITableView has a width of 320 and a height of 220. It covers half of the screen and can be minimized or maximized. The view is initialized with the UITableView in a minimized state with just the top section header showing at the bottom of the screen. When the user clicks on a button in the section header the UITableView is expanded form the bottom up to cover half of the viewable screen. The expansion and minimization of the UITableView is where the UITableView is animated. When the user clicks the maximize/minimize button the the y component of the UITableView frame is changed to move it accordingly. Here is the code I use to animate the table view:
UIImage *downImage = [UIImage imageNamed:#"arrowDown.png"];
UIImage *upImage = [UIImage imageNamed:#"arrowUp.png"];
UIButton *btnExpandCompress = (UIButton *)sender;
[btnExpandCompress setEnabled:NO];
if (showingTable)
{
[UIView animateWithDuration:0.7 animations:^{
CGRect frame = animatedTable.frame;
frame.origin.y += animatedTable.frame.size.height - 30;
animatedTable.frame = frame;
} completion:^(BOOL finished) {
showingTable = NO;
[btnExpandCompress setEnabled:YES];
[btnExpandCompress setBackgroundImage:upImage forState:UIControlStateNormal];
}];
}
else
{
[UIView animateWithDuration:0.7 animations:^{
CGRect frame = animatedTable.frame;
frame.origin.y -= animatedTable.frame.size.height - 30;
animatedTable.frame = frame;
} completion:^(BOOL finished) {
showingTable = YES;
[btnExpandCompress setEnabled:YES];
[btnExpandCompress setBackgroundImage:downImage forState:UIControlStateNormal];
}];
}
As can be seen above all I do is change the y component of the frame. Originally the frame of the UITableView has a y component of 583 which is mentioned in the original constraint warning <NSIBPrototypingLayoutConstraint:0x170a95db0 'IB auto generated at build time for view with fixed frame' V:|-(538)-[UITableView:0x140330c00] (Names: '|':UIView:0x170199640 )>. I don't set any additional constraints for the UITableView, just drag it from the object library and move it to its initial minimized position. I am guessing that by changing the frames y component I'm breaking a fixed constraint that is getting set by default. I hope this additional information helps. How can I fix this?
There is problem with your tableview
You have set multiple values for height of tableview
constraint -538 height tableview.
As you have set fixed height for tableview
If you are setting tableview according to navigation bar, means under
Navigation bar, it should be 504 instead of .
If you have only one TableView you can remove all the contraints an
pin that to 0,0,0,0 .
else you have to show a screenshot of your view controller along with constraints
Thanks
Related
I've got a UITableViewController, with a custom view, with some subviews and controls inside, in the header of the table. Each one of these subviews are a custom subview (use a custom subview to draw corner radius with IBInspectable) and each have constraints for top, bottom, leading and trailing space (all set to 8) as well as for height (set to 60, 80 or 100, depending of each subview).
One of these subviews constraints can be modified programmatically in run time depending of user interaction. To do that, I create this two methods:
- (void)showSearchTypeTermField:(BOOL)animated
{
self.searchTypeHeightConstraint.identifier = #"Height 100";
[self.searchTypeHeightConstraint setConstant:100.0];
if (animated) {
[self.tableView.tableHeaderView layoutIfNeeded];
[UIView animateWithDuration:0.3 animations:^{
[self.tableView.tableHeaderView layoutIfNeeded];
}];
} else {
[self.tableView.tableHeaderView layoutIfNeeded];
}
self.searchTypeTermField.hidden = NO;
self.searchTypeTermField.text = #"";
[self.tableView.tableHeaderView systemLayoutSizeFittingSize:UILayoutFittingExpandedSize];
}
- (void)hideSearchTypeTermField:(BOOL)animated
{
self.searchTypeHeightConstraint.identifier = #"Height 60";
[self.tableView.tableHeaderView setAutoresizingMask:UIViewAutoresizingFlexibleHeight];
[self.searchTypeHeightConstraint setConstant:60.0];
if (animated) {
[self.tableView.tableHeaderView layoutIfNeeded];
[UIView animateWithDuration:0.3 animations:^{
[self.tableView.tableHeaderView layoutIfNeeded];
}];
} else {
[self.tableView.tableHeaderView layoutIfNeeded];
}
self.searchTypeTermField.hidden = YES;
[self.tableView.tableHeaderView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize];
}
Because all of these subviews are in the table header view, every time I change the constraint, header should expand or compress depending of the case, thats why I use self.tableView.tableHeaderView systemLayoutSizeFittingSize.
The problem is I'm getting this error, when I call [self hideSearchTypeTermField:NO] the first time on viewdidLoad despite that visually everything seems fine:
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:0x7bf504e0 V:[SeachFormBackgroundView:0x7bea3ab0(60)]>",
"<NSLayoutConstraint:0x7bf51760 V:[SeachFormBackgroundView:0x7bf50690(60)]>",
"<NSLayoutConstraint:0x7bf53390 'Height 60' V:[SeachFormBackgroundView:0x7bf518e0(60)]>",
"<NSLayoutConstraint:0x7bf53ec0 V:[SeachFormBackgroundView:0x7bf535a0(80)]>",
"<NSLayoutConstraint:0x7bf54a80 V:[SeachFormBackgroundView:0x7bf54180(80)]>",
"<NSLayoutConstraint:0x7bf54eb0 V:|-(8)-[SeachFormBackgroundView:0x7bea3ab0] (Names: '|':UIView:0x7bea3a10 )>",
"<NSLayoutConstraint:0x7bf54f40 V:[SeachFormBackgroundView:0x7bea3ab0]-(8)-[SeachFormBackgroundView:0x7bf50690]>",
"<NSLayoutConstraint:0x7bf54f70 V:[SeachFormBackgroundView:0x7bf50690]-(8)-[SeachFormBackgroundView:0x7bf518e0]>",
"<NSLayoutConstraint:0x7bf55090 V:[SeachFormBackgroundView:0x7bf518e0]-(8)-[SeachFormBackgroundView:0x7bf535a0]>",
"<NSLayoutConstraint:0x7bf550f0 V:[SeachFormBackgroundView:0x7bf54180]-(8)-| (Names: '|':UIView:0x7bea3a10 )>",
"<NSLayoutConstraint:0x7bf55180 V:[SeachFormBackgroundView:0x7bf535a0]-(8)-[SeachFormBackgroundView:0x7bf54180]>",
"<NSAutoresizingMaskLayoutConstraint:0x7c149fc0 h=--& v=--& V:[UIView:0x7bea3a10(428)]>"
)
I'm really lost with this issue. What I'm doing wrong?
Thanks.
If you try adding the heights for the SeachFormBackgroundView instances (60 + 60 + 60 + 80 + 80 + 8 * 6 = 388 and their separators you'll see that they aren't equal to the parent UIView height (428). That's why you get this message.
You have to either adjust the constraints so that they add up to the parent view height, or resize the parent so that it's size matches the child constraints.
You don't need all of the constraints you have right now. Since you're setting a specific height to all of the subviews and spacing constraints, you only need to anchor them to the top or to the bottom of the superview.
Edit:
You don't need both of these constraints: V:|-(8)-[SeachFormBackgroundView:0x7bea3ab0] and V:[SeachFormBackgroundView:0x7bf54180]-(8)-|. The first one anchors your subviews to the top of the superview, and the scond one anchors them to the bottom of your superview. Remove one of them (I'd expect the bottom one) and the views will fall in place without throwing any AutoLayout exceptions.
When you set the header view the table view reads its size and sets a constraint for that height. Updating the constraints on the header view itself don't cause a reevaluation of that height. You should remove the header view, update its constraints, lay it out and then add the header view again.
I have a UIView in a UITableViewCell. in the view, I have a UITextView and a UIView. They are both auto constraint on all 4 sides.
The UIView has a height constraint. I would like to update the height constraint prorrammatically. I made a outlet of the height constraint so I can change it.
Here is my code:
CGRect frame = self.myView.frame;
frame.size.height = 50;
frame.size.width = self.myView.frame.size.width;
self.myView.frame = frame;
self.viewHeight.constant = 50;
[myTableView reloadData];
When I run this code, it works perfectly, but I get an error: (I'm pretty new to objective c, so I don't understand what it's trying to say.)
2015-01-26 15:25:43.408 myApp[1449:55334] 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:0x7fb07853ac20 V:[UIView:0x7fb0784dbb80(50)]>",
"<NSLayoutConstraint:0x7fb0785bd170 V:|-(0)-[UITextView:0x7fb07896de00] (Names: '|':UIView:0x7fb07857fb70 )>",
"<NSLayoutConstraint:0x7fb0785bd260 V:[UITextView:0x7fb07896de00]-(3)-[UIView:0x7fb0784dbb80]>",
"<NSLayoutConstraint:0x7fb0785bd350 V:[UIView:0x7fb0784dbb80]-(0)-| (Names: '|':UIView:0x7fb07857fb70 )>",
"<NSLayoutConstraint:0x7fb0785bd5b0 UILabel:0x7fb0785150f0'info:'.top == UITableViewCellContentView:0x7fb078581400.topMargin>",
"<NSLayoutConstraint:0x7fb0785bd650 UITableViewCellContentView:0x7fb078581400.bottomMargin == UIView:0x7fb07857fb70.bottom + 1>",
"<NSLayoutConstraint:0x7fb0785bd6f0 V:[UILabel:0x7fb0785150f0'info:']-(8)-[UIView:0x7fb07857fb70]>",
"<NSLayoutConstraint:0x7fb078704f20 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fb078581400(77)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fb07853ac20 V:[UIView:0x7fb0784dbb80(50)]>
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.
You programmaticlly change the height constraint to 50. It is unsatisfied with UIView-Encapsulated-Layout-Height constraint(77), which is set by iOS for UITableViewCellContentView.
when I run my app on an iPhone I get the following errors. When I run it in the simulator I do not. If I take the -12-| away then the cell's height collapses to something like 30 pixels. And the UI breaks.
Can someone help me and tell me why?
Thanks
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:0x170285ff0 V:|-(12)-[UIImageView:0x1741ec200] (Names: '|':UITableViewCellContentView:0x17419c7d0 )>",
"<NSLayoutConstraint:0x170286040 V:[UIImageView:0x1741ec200(200)]>",
"<NSLayoutConstraint:0x170286090 V:[UIImageView:0x1741ec200]-(12)-| (Names: '|':UITableViewCellContentView:0x17419c7d0 )>",
"<NSLayoutConstraint:0x174881f40 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x17419c7d0(224)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x170286090 V:[UIImageView:0x1741ec200]-(12)-| (Names: '|':UITableViewCellContentView:0x17419c7d0 )>
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.
Warning once only: Detected a case where constraints ambiguously suggest a height of zero for a tableview cell's content view. We're considering the collapse unintentional and using standard height instead.
Unable to simultaneously satisfy constraints.
In a custom UITableViewCell I defined the Layout Constraints as follows:
_imgView.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:#"H:|-15-[imageView]-15-|" options:0 metrics:nil views:#{ #"imageView": _imgView }]];
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:#"V:|-12-[imageView(200)]-12-|" options:0 metrics:metrics views:#{ #"imageView" : _imgView }]];
--- EDIT ---
In response to the contentView.bounds suggestion:
In my UITableViewController I implement the following:
_tableView.rowHeight = UITableViewAutomaticDimension;
_tableView.estimatedRowHeight = 30.0f;
So a zero height, should not be an issue.
The initial height of the cell is likely smaller than the vertical constraints. This creates an initial height conflict until the contentView's frame changes.
You can work around this issue using one of the following approaches:
Increase the cell's height in the storyboard to initially fit the content.
Change the bounds of the cell's contentView to a larger size:
self.contentView.bounds = CGRectMake(0, 0, 99999, 99999);
You'll find more details in the answers to this auto layout question.
Update:
The "Unable to simultaneously satisfy constraints" conflict is between the imageView constraints trying to set the cell's height to 225 points, and the fixed height trying to set the cell height to 224 points.
Your imageView vertical constraints use 224 (12 + 200 + 12) points. The tableView separator uses 1 point. So the cell height needs to be 225 points for all constraints to be met.
I added 1 view in XIB, it is set autolayout. But when run, i want to to change frame of that view. I know if using autolayout, need to set translatesAutoresizingMaskIntoConstraints = YES in my code. I have done that, I create new frame for that view but it shows the warning message in console:
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)
(
"<NSIBPrototypingLayoutConstraint:0x16e4b750 'IB auto generated at build time for view with fixed frame' V:|-(0)-[UIView:0x16ed3c30] (Names: '|':UIView:0x16ee06b0 )>",
"<NSAutoresizingMaskLayoutConstraint:0x16e19e30 h=-&- v=-&- UIView:0x16ed3c30.midY == UIView:0x16ee06b0.midY + 44>",
"<NSAutoresizingMaskLayoutConstraint:0x16e19e60 h=-&- v=-&- UIView:0x16ed3c30.height == UIView:0x16ee06b0.height>"
)
Will attempt to recover by breaking constraint
<NSIBPrototypingLayoutConstraint:0x16e4b750 'IB auto generated at build time for view with fixed frame' V:|-(0)-[UIView:0x16ed3c30] (Names: '|':UIView:0x16ee06b0 )>
Break on objc_exception_throw to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
This is the code for create new frame, i just want the origin of Y is equal to 0.
self.leftView.frame= CGRectMake(0, 0, 40, self.view.frame.size.height);
How can i fix that bug? Please give some advice. Thanks much.
If I understand you correctly, I think you need to use a stored NSLayoutConstraint variable in your class, then update the constraint's constant value to 0 to make your UIView slide to the top.
Also, when you're using autolayout, you usually set:
myView.translateAutoResizingMaskIntoConstraint = NO;
That's NO instead of YES.
So an example would be something like:
#interface MyViewController()
{
NSLayoutConstraint *myViewTopConstraint;
}
#end
#implementation MyViewController
-(void)setupMyConstraintsMethod
{
...
// ---------------------------------------------------------------
// This constraint here says "myView" top edge should be pinned
// to the top edge of the view controller's view but with an offset
// of 50 pixels.
// ---------------------------------------------------------------
NSLayoutConstraint *myViewTopConstraint = [NSLayoutConstraint constraintWithItem:self.myView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:50.0];
[self.view addConstraint:myViewTopConstraint];
}
-(void)buttonPressed:(id)sender
{
// ------------------------------------------------------------
// now you want myView's top edge to be at the top of your
// view controller's view, so you set the constant to 0
// ------------------------------------------------------------
myViewTopConstraint.constant = 0;
// animates the sliding up of "myView"
[UIView animateWithDuration:0.5 animations:^{
[self.view layoutIfNeeded];
}];
}
#end
I've got a UITableViewCell which contains a UIWebView. The table view cell adjusts it's height depending on the web view contents.
I've got it all working fine, however when the view loads, I get a constraint violation exception in the debugger (the app continues running and functionally works fine, but I'd like to resolve this exception if possible).
How I've got it set up:
The TableView sets the cell height like this:
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if(indexPath.section == 0) {
[_topCell layoutIfNeeded];
CGFloat finalHeight = [_topCell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height;
return finalHeight + 1;
}
The cell constraints are as follows:
Arbitrary 7px offset from the cell's contentView (top) to the webView
Web view has arbitrary fixed height constraint of 62px (will expand later once content loads)
Arbitrary 8px offset from the webView to the cell's contentView (bottom)
in my viewDidLoad, I tell the webView to go and load a URL, and in the webViewDidFinishLoad, I update the web view height constraint, like this
-(void)webViewDidFinishLoad:(UIWebView *)webView {
CGSize fittingSize = [webView sizeThatFits:CGSizeZero];
// fittingSize is approx 500
[self.tableView beginUpdates];
// Exceptions happen on the following line setting the constant
_topCell.webViewHeightConstraint.constant = fittingSize.height;
[_topCell layoutSubviews];
[self.tableView endUpdates];
}
The exception looks like 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. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSLayoutConstraint:0x10964b250 V:[webView(62)] (Names: webView:0x109664a00 )>",
"<NSLayoutConstraint:0x109243d30 V:|-(7)-[webView] (Names: webView:0x109664a00, cellContent:0x1092436f0, '|':cellContent:0x1092436f0 )>",
"<NSLayoutConstraint:0x109243f80 V:[webView]-(8)-| (Names: cellContent:0x1092436f0, webView:0x109664a00, '|':cellContent:0x1092436f0 )>",
"<NSAutoresizingMaskLayoutConstraint:0x10967c210 h=--& v=--& V:[cellContent(78)] (Names: cellContent:0x1092436f0 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x10964b250 V:[webView(62)] (Names: webView:0x109664a00 )>
This seems a bit weird. It's implied that the constraint which sets the height of the web view is going to be broken, however the web view does get it's height correctly set, and the tableview renders perfectly well.
From my guesses, it looks like the newly increased web view height constraint (it's about 500px after the web view loads) is going to conflict with the <NSAutoresizingMaskLayoutConstraint:0x10967c210 h=--& v=--& V:[cellContent(78)] setting the cell height to 78 (put there by interface builder). This makes sense, however I don't want that cell content to have a fixed height of 78px, I want it to increase it's height, and functionally, it actually does this, just with these exceptions.
I've tried setting _topCell.contentView.translatesAutoresizingMaskIntoConstraints = NO; to attempt to remove the NSAutoresizingMaskLayoutConstraint - this stops the exceptions, but then all the other layout is screwed up and the web view is about 10px high in the middle of the table view for no reason.
I've also tried setting _topCell.contentView.autoresizingMask |= UIViewAutoresizingFlexibleHeight; in the viewDidLoad to hopefully affect the contentView 78px height constraint, but this has no effect
Any help would be much appreciated
An alternative answer, which ends up being far simpler:
Set the priority of the webViewHeight constraint to something other than required. Works well and there are no warnings. I'd recommend going with this :-)
I worked out a solution. It seems like a hack, but it works correctly and produces no errors and warnings.
The trick was to dissociate the web view's layout and height from the contentView.
I did this as follows:
In the tableviewcell, add a new UIView, called containerView
Give it constraints for Top:0 Left:0 Right:0 but no bottom constraint and no height constraint
Put the web view (and any other content) inside this containerView
Add constraints such that the web view is 7px from the top and bottom of containerView, and has a height constraint of 62px
At this point, the containerView isn't connected to the bottom of the table view cell, and so it could over/under flow without auto-layout complaining.
Now, in tableView:heightForRowAtIndexPath:, we calculate the cell height based on the containerView as follows:
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if(indexPath.section == 0) {
CGFloat finalHeight = [_topCell.containerView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height;
return finalHeight + 1;
}
return [super tableView:tableView heightForRowAtIndexPath:indexPath];
}
All done!
From the Constraint log
The Constraint you are trying to achieve is as below,
In a 78 px cellContentHeight you want to fit a content of 7(top space) + 62 (Web View) + 8 (bottom space). which is 77 (not equal to 78). Either of two option would work,
Try giving top margin as 8 (instead of 7) and make it 78. (V:|-8-[WebView(62)]-8-|)
Attach to the top, give 8 pixel top space (V:|-8-[WebView(62)]) and don't specify 8 px bottom space.
Attach to Bottom, give 8 pixel bottom space (V:[WebView(62)-8-|) and don't specify top space.