已經通過大同小異的疼痛消失了,你,我的建議是兩方面:
- 看一看在Cirrious FluentLayouts包,你可以從 得到的NuGet。
在簡化各種自動佈局問題方面提供了巨大的幫助,特別是如果您決定放棄GUI佈局工具並採用完整的程序化方法時(尤其是像我一樣)。
它將使同樣的結構:
this.AddConstraints
(
_navBar.AtTopOf(this, UIApplication.SharedApplication.StatusBarFrame.Height),
_navBar.AtLeftOf(this),
_navBar.WithSameWidth(this),
_navBar.Height().EqualTo(Hamburger.HamburgerHeight),
_scrollView.Below(_navBar),
_scrollView.AtLeftOf(this),
_scrollView.WithSameWidth(this),
_scrollView.Bottom().EqualTo().TopOf(_pageControl),
_pageControl.Above(_toolBar),
_pageControl.AtLeftOf(this),
_pageControl.WithSameWidth(this),
_pageControl.Height().EqualTo(pageControlHeight),
_toolBar.Above(_button),
_toolBar.AtLeftOf(this),
_toolBar.WithSameWidth(this),
_toolBar.Height().EqualTo(toolHeight),
_button.AtRightOf(this),
_button.AtBottomOf(this),
_button.Height().EqualTo(buttonHeight)
);
- 注意,因爲...的iOS 8我相信嗎? ...您現在需要使用 LaunchScreen.xib讓您的應用程序正確地獲取設備 分辨率,然後通過自動佈局使用該分辨率。
這是我仍然需要使用圖形佈局工具的一個領域 - 只有一次,很高興地說。
嘗試搜索iOS Auto Layout Constraints;即http://mobileoop.com/how-to-use-auto-layout-in-xcode-6-for-ios-7-and-8-development&http://mobileoop.com/auto-layout-advanced -techniques-for-ios-8-and-7-using-xcode-6-on-storyboard ... – SushiHangover
發現這個tutoriar,繼此之後,我得到了它的工作。 https://developer.xamarin.com/guides/ios/user_interface/designer/designer_auto_layout/ – JensB