2012-12-26 46 views
0

我有一個故事板文件,我添加了一個UITableView和一個UIView。 UIView是我試圖做一個自定義頭,這將是半透明的,因此tableview將通過它可見(我不知道這是甚至可能的,因爲我是一個新手,這是我的第一個iPhone應用程序)。Addings對UIView的兩個視圖

處理與我的ViewController類,所有的連接後,當我運行的代碼,我給了我這個錯誤:

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:0x8988060 h=--& v=--& V:[UIView:0x7574100(460)]>", 
"<NSLayoutConstraint:0x7574780 V:|-(0)-[UIView:0x75742b0] (Names: '|':UIView:0x7574100  )>", 
"<NSLayoutConstraint:0x7574700 V:[UIView:0x75742b0]-(494)-| (Names: '|':UIView:0x7574100)>" 
) 

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7574700 V:[UIView:0x75742b0]-(494)-| (Names: '|':UIView:0x7574100 )> 

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. 

爲什麼發生這種情況會有所幫助的任何想法。謝謝。

回答

2

您已經在界面構建器中配置了一個不可能的狀態,如消息所示,您擁有的佈局約束不能一次全部滿足。當你是新的,我會建議禁用自動佈局約束(去文檔選項卡 - 最左邊的選項卡 - 在界面生成器,並取消選中自動佈局)這將讓你擺脫這個問題

是的,你可以有兩個視圖彼此之間,你只需要玩alpha值來配置半透明

+0

這樣做。非常感謝。 :) –

+0

很高興幫助,那麼你應該將此標記爲答案 –