self.contentView.translatesAutoresizingMaskIntoConstraints = NO;

解決方法 UIView的屬性
self.contentView.translatesAutoresizingMaskIntoConstraints = NO;

/* By default, the autoresizing mask on a view gives rise to constraints that fully determine
the view's position. This allows the auto layout system to track the frames of views whose
layout is controlled manually (through -setFrame:, for example).
When you elect to position the view using auto layout by adding your own constraints,
you must set this property to NO. IB will do this for you.
*/
@property(nonatomic) BOOL translatesAutoresizingMaskIntoConstraints NS_AVAILABLE_IOS(6_0); // Default YES

問(wèn)題現(xiàn)象:運(yùn)行時(shí)控制臺(tái)打印錯(cuò)誤日志
2016-08-23 14:18:33.213 haokanLive[3428:2068691] Warning once only: Detected a case where constraints ambiguously suggest a size of zero for a collection view cell's content view. We're considering the collapse unintentional and using standard size instead.
2016-08-23 14:18:33.219 haokanLive[3428:2068691] yiyang****的****cell的contentView<UIView: 0x14e745a20; frame = (0 0; 375 460); gestureRecognizers = <NSArray: 0x14e55bde0>; layer = <CALayer: 0x14e745250>>
2016-08-23 14:18:35.464 haokanLive[3428:2068691] 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:0x14e554e50 h=--& v=--& H:[UIView:0x14e555180(0)]>",**
** "<NSLayoutConstraint:0x14e547020 H:[UILabel:0x14e5527a0'\U6807\U9898']-(8)-| (Names: '|':UIView:0x14e555180 )>",**
** "<NSLayoutConstraint:0x14e5470c0 H:|-(8)-[UILabel:0x14e5527a0'\U6807\U9898'] (Names: '|':UIView:0x14e555180 )>"**
)


**Will attempt to recover by breaking constraint **
<NSLayoutConstraint:0x14e547020 H:[UILabel:0x14e5527a0'****標(biāo)題****']-(8)-| (Names: '|':UIView:0x14e555180 )>


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-08-23 14:18:35.467 haokanLive[3428:2068691] 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) **
(

其實(shí)在涉及到UICollectionView自定義layout布局的時(shí)候,設(shè)置上面的屬性=NO,治標(biāo)不治本,解決不了實(shí)際問(wèn)題.需要重寫(xiě)三個(gè)方法
prepareLayout 準(zhǔn)備布局方法
//這里可以創(chuàng)建數(shù)組或者字典計(jì)算每一個(gè)cell的frame存儲(chǔ)起來(lái)

  • (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect 相交范圍內(nèi)的cell的布局?jǐn)?shù)組

  • (CGSize)collectionViewContentSize 整個(gè)collectionView的contentSize


Warning once only: Detected a case where constraints ambiguously suggest a size of zero for a collection view cell's content view. We're considering the collapse unintentional and using standard size instead.

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

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.

By default, the autoresizing mask on a view gives rise to constraints that fully determine
the view's position. This allows the auto layout system to track the frames of views whose
layout is controlled manually (through -setFrame:, for example).
When you elect to position the view using auto layout by adding your own constraints,
you must set this property to NO. IB will do this for you.

警告:一次只檢測(cè)到的情況下,約束隱約表明集合視圖單元格的內(nèi)容視圖的大小為零灾常。我們正在考慮崩潰無(wú)意和使用標(biāo)準(zhǔn)的大小嚼吞,而不是闰蛔。
如果你看到nsautoresizingmasklayoutconstraints,你不明白斧蜕,請(qǐng)參閱文檔屬性translatesautoresizingmaskintoconstraints UIView
將試圖通過(guò)打破約束恢復(fù)
做一個(gè)象征性的斷點(diǎn)在uiviewalertforunsatisfiableconstraints抓住在調(diào)試器瓤帚。
在uiconstraintbasedlayoutdebugging類UIView在<< UIKit / UIView上市的方法可能也有幫助嘿架《舛”栅屏。
默認(rèn)情況下,視圖的自動(dòng)調(diào)整尺寸面具產(chǎn)生約束艾扮,完全確定
視圖位置既琴。這允許自動(dòng)布局系統(tǒng)跟蹤的視圖的框架,其
布局是手動(dòng)控制(通過(guò)setframe:泡嘴,例如)。
當(dāng)您選擇放置視圖時(shí)逆济,通過(guò)添加您自己的約束來(lái)使用自動(dòng)布局酌予,
你必須將此屬性設(shè)置為第IB將為你做這個(gè)。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末奖慌,一起剝皮案震驚了整個(gè)濱河市抛虫,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌简僧,老刑警劉巖建椰,帶你破解...
    沈念sama閱讀 211,265評(píng)論 6 490
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場(chǎng)離奇詭異岛马,居然都是意外死亡棉姐,警方通過(guò)查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 90,078評(píng)論 2 385
  • 文/潘曉璐 我一進(jìn)店門(mén)啦逆,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)伞矩,“玉大人,你說(shuō)我怎么就攤上這事夏志∧死ぃ” “怎么了?”我有些...
    開(kāi)封第一講書(shū)人閱讀 156,852評(píng)論 0 347
  • 文/不壞的土叔 我叫張陵,是天一觀的道長(zhǎng)湿诊。 經(jīng)常有香客問(wèn)我狱杰,道長(zhǎng),這世上最難降的妖魔是什么厅须? 我笑而不...
    開(kāi)封第一講書(shū)人閱讀 56,408評(píng)論 1 283
  • 正文 為了忘掉前任仿畸,我火速辦了婚禮,結(jié)果婚禮上九杂,老公的妹妹穿的比我還像新娘颁湖。我一直安慰自己,他們只是感情好例隆,可當(dāng)我...
    茶點(diǎn)故事閱讀 65,445評(píng)論 5 384
  • 文/花漫 我一把揭開(kāi)白布甥捺。 她就那樣靜靜地躺著,像睡著了一般镀层。 火紅的嫁衣襯著肌膚如雪镰禾。 梳的紋絲不亂的頭發(fā)上,一...
    開(kāi)封第一講書(shū)人閱讀 49,772評(píng)論 1 290
  • 那天唱逢,我揣著相機(jī)與錄音吴侦,去河邊找鬼。 笑死坞古,一個(gè)胖子當(dāng)著我的面吹牛备韧,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播痪枫,決...
    沈念sama閱讀 38,921評(píng)論 3 406
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼织堂,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼!你這毒婦竟也來(lái)了奶陈?” 一聲冷哼從身側(cè)響起易阳,我...
    開(kāi)封第一講書(shū)人閱讀 37,688評(píng)論 0 266
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤,失蹤者是張志新(化名)和其女友劉穎吃粒,沒(méi)想到半個(gè)月后潦俺,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 44,130評(píng)論 1 303
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡徐勃,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 36,467評(píng)論 2 325
  • 正文 我和宋清朗相戀三年事示,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片疏旨。...
    茶點(diǎn)故事閱讀 38,617評(píng)論 1 340
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡很魂,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出檐涝,到底是詐尸還是另有隱情遏匆,我是刑警寧澤法挨,帶...
    沈念sama閱讀 34,276評(píng)論 4 329
  • 正文 年R本政府宣布,位于F島的核電站幅聘,受9級(jí)特大地震影響凡纳,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜帝蒿,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 39,882評(píng)論 3 312
  • 文/蒙蒙 一荐糜、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧葛超,春花似錦暴氏、人聲如沸。這莊子的主人今日做“春日...
    開(kāi)封第一講書(shū)人閱讀 30,740評(píng)論 0 21
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)。三九已至侥涵,卻和暖如春沼撕,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背芜飘。 一陣腳步聲響...
    開(kāi)封第一講書(shū)人閱讀 31,967評(píng)論 1 265
  • 我被黑心中介騙來(lái)泰國(guó)打工务豺, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人嗦明。 一個(gè)月前我還...
    沈念sama閱讀 46,315評(píng)論 2 360
  • 正文 我出身青樓笼沥,卻偏偏與公主長(zhǎng)得像,于是被迫代替她去往敵國(guó)和親娶牌。 傳聞我的和親對(duì)象是個(gè)殘疾皇子敬拓,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 43,486評(píng)論 2 348

推薦閱讀更多精彩內(nèi)容