2016-11-23 35 views
0

我試圖使用MarkupKit實現簡單的佈局,但我總是會在左側和右側獲得一點點空間。有沒有辦法避免這種情況?總是與LMColumnView和LMRowView左右間距

<LMColumnView backgroundColor="#ffffff"> 
    <LMSpacer weight="1"/> 
    <LMRowView layoutMargins="0" spacing="0" alignToBaseline="true"> 
     <UIButton weight="1" style="systemButton" title="1" backgroundColor="left_btn_bg.png"/> 
     <UIButton weight="1" style="systemButton" title="2" backgroundColor="mid_btn_bg.png"/> 
     <UIButton weight="1" style="systemButton" title="3" backgroundColor="right_btn_bg.png"/> 
    </LMRowView> 
</LMColumnView> 

回答

0

左側和右側的間隙是由UIKit自動應用的不變的邊距。將layoutMargins="0"添加到您的根目錄LMColumnView應該可以工作,但它不會。我前一段時間向蘋果提交了一份關於此問題的錯誤報告,但我從未得到過答覆。

最簡單的解決方法是添加layoutMarginsRelativeArrangement="false"到您的根視圖:

<LMColumnView layoutMarginsRelativeArrangement="false" backgroundColor="#ffffff"> 
    ... 
</LMColumnView> 

這告訴UIKit中忽略默認邊距,所以內容將與列視圖的邊緣齊平。