簡體   English   中英

如何擺脫2個視圖之間的空間

[英]How do I get rid of space between 2 views

我下面有一個帶有iAd BannerUITableView 我對它們應用了constraints

表格檢視
在此處輸入圖片說明

iAd橫幅
在此處輸入圖片說明

有時 ,當我運行應用程序時, banner banner加載后, tableViewbanner之間會有一個空格( banners高度)。 這很奇怪,因為它只是偶爾發生。 我無法確定何時發生和何時不發生。

但是,當有空間並旋轉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
}

您可能需要向iAd條幅添加高度限制,然后查看是否可以解決該問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM