如何摆脱 2 个视图之间的 space
How do I get rid of space between 2 views
我有一个 UITableView
,下面有一个 iAd Banner
。我给他们申请了constraints
:
表格视图
iAd 横幅
有时,当我运行应用程序时,在tableView
和 banner
加载后的 banner
。这很奇怪,因为它只是偶尔发生。我无法确定它何时发生以及何时不发生。
但是当存在 space 并且我旋转 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.
我怎样才能摆脱那个space?
这是我的代码:
func bannerViewDidLoadAd(banner: ADBannerView!) {
self.bottomAddView?.hidden = false
}
func bannerView(banner: ADBannerView!, didFailToReceiveAdWithError error: NSError!) {
self.bottomAddView?.hidden = true
}
您可能想为 iAd 横幅添加高度限制,看看是否能解决问题。
我有一个 UITableView
,下面有一个 iAd Banner
。我给他们申请了constraints
:
表格视图
iAd 横幅
有时,当我运行应用程序时,在tableView
和 banner
加载后的 banner
。这很奇怪,因为它只是偶尔发生。我无法确定它何时发生以及何时不发生。
但是当存在 space 并且我旋转 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.
我怎样才能摆脱那个space?
这是我的代码:
func bannerViewDidLoadAd(banner: ADBannerView!) {
self.bottomAddView?.hidden = false
}
func bannerView(banner: ADBannerView!, didFailToReceiveAdWithError error: NSError!) {
self.bottomAddView?.hidden = true
}
您可能想为 iAd 横幅添加高度限制,看看是否能解决问题。