我有一个UITableView
,其下面有一个iAd Banner
。我将constraints
应用于他们:
有时,当我运行应用时,banners
和tableView
之间有一个空格(banner
高度的数量)在banner
加载之后。这很奇怪,因为它有时只会发生。我无法确定它何时发生以及何时发生。
但是当有空间并且我旋转iPhone时,我收到以下消息:
[4381:133861] 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:0x79039930 V:[UILabel:0x79039800'00:45'(57)]>",
"<NSLayoutConstraint:0x79036f30 V:[UIButton:0x79036d50'First'(60)]>",
"<NSLayoutConstraint:0x79035f80 V:[UIButton:0x79036620'second'(60)]>",
"<NSLayoutConstraint:0x79039ec0 V:|-(8)-[UILabel:0x79039800'00:45'] (Names: '|':UIView:0x79039d00 )>",
"<NSLayoutConstraint:0x79039f80 V:[UILabel:0x79039800'00:45']-(8)-[UIButton:0x79036d50'First']>",
"<NSLayoutConstraint:0x7903a070 V:[UIButton:0x79036d50'First']-(8)-[UIButton:0x79036620'second']>",
"<NSLayoutConstraint:0x7903a0a0 V:[UIButton:0x79036620'second']-(0)-| (Names: '|':UIView:0x79039d00 )>",
"<NSLayoutConstraint:0x79038240 V:|-(0)-[ADDimmerView:0x7861e140] (Names: '|':ADBannerView:0x79037290 )>",
"<NSLayoutConstraint:0x790382b0 V:[ADDimmerView:0x7861e140]-(0)-| (Names: '|':ADBannerView:0x79037290 )>",
"<NSLayoutConstraint:0x7903abb0 V:[_UILayoutGuide:0x7903a1e0]-(0)-[UIView:0x79039d00]>",
"<NSLayoutConstraint:0x7903ac40 V:[UIView:0x79039d00]-(8)-[UITableView:0x78c02a00]>",
"<NSLayoutConstraint:0x7903aca0 ADBannerView:0x79037290.bottom == _UILayoutGuide:0x7903a730.top>",
"<NSLayoutConstraint:0x7903acd0 V:[UITableView:0x78c02a00]-(0)-[ADBannerView:0x79037290]>",
"<_UILayoutSupportConstraint:0x790356e0 V:[_UILayoutGuide:0x7903a1e0(64)]>",
"<_UILayoutSupportConstraint:0x790357b0 V:|-(0)-[_UILayoutGuide:0x7903a1e0] (Names: '|':UIView:0x79039c40 )>",
"<_UILayoutSupportConstraint:0x79035920 V:[_UILayoutGuide:0x7903a730(0)]>",
"<_UILayoutSupportConstraint:0x79035680 _UILayoutGuide:0x7903a730.bottom == UIView:0x79039c40.bottom>",
"<NSLayoutConstraint:0x79045280 'UIView-Encapsulated-Layout-Height' V:[UIView:0x79039c40(270)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x79035f80 V:[UIButton:0x79036620'second'(60)]>
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.
我怎样摆脱那个空间?
这是我的代码:
func bannerViewDidLoadAd(banner: ADBannerView!) {
self.bottomAddView?.hidden = false
}
func bannerView(banner: ADBannerView!, didFailToReceiveAdWithError error: NSError!) {
self.bottomAddView?.hidden = true
}
答案 0 :(得分:0)
您可能需要为iAd横幅添加一个约束高度,看看是否可以修复它。