2016-10-08 155 views
1

我有View裏面ScrollView。在末端我的看法我已經提交Button。提交按鈕約束如下。ios中的奇怪行爲UIButton(Xamarin)

鍵約束:

Top to superView : 630 
Leading to superView : 40 

滾動型約束:

Top to superView : 0 
Leading to superView : 0 
Trainling to superView : 0 
Bottom to superView : 0 

視圖(這是我的滾動型內部)約束:

Top to superView : 0 
Leading to superView : 0 
Trainling to superView : 0 
Bottom to superView : 0 

當我設置上限時,ScrollView處於正常行爲意味着它可以從上到下滾動。

但是,當增加寬度Button意味着我想從兩邊40約束設置Button。那個時候ScrollView不滾動。

更改按鈕後約束:

Top to superView : 630 
Leading to superView : 40 
Traling to superView : 40 

爲什麼發生這種情況,我不知道嗎?

任何幫助被讚賞。

回答

2

我已經嘗試過了,下面的設置爲我的作品罰款:

鍵約束:

Top to superView : 630 
Leading to superView : 40 
Trailing to superView : 40 (@750) 
Bottom to superview: 0 

滾動型約束:

Top to Top Layout Guide : 0 
Leading to superView : 0 
Trainling to superView : 0 
Bottom to superView : 0 

視圖(這是我的滾動型內部)約束:

Top to superView : 0 
Leading to superView : 0 
Trainling to superView : 0 
Bottom to superView : 0 
Width : equal to superview 

使用scrollview時,內部視圖需要所有約束(頂部,前導,尾部,底部)。否則,scrollview無法計算其內容視圖。

+0

等我試着實現你的答案並儘快告訴你。 – Ironman

+1

感謝您的幫助。我試圖讓它持續2天。最後它在你的幫助下工作。 – Ironman