xamarin IOS designer cannot constraint to super view edges?

亡梦爱人 提交于 2020-01-07 06:17:10

问题


I just updated my Xamarin version and I found that I cannot constraint to the leading edge or trailing edge of the Container View. However, I can only constraint to the Leading margin or Trailing margin(Picture Attached). Is there a way to let me constraint to the edges of a super view not the margin?


回答1:


Here's my workaround for the time being:

  1. Set the constraint in the designer, then save and close it.
  2. Open the storyboard in a text editor and update the constraint element's attribute from "leadingMargin" (or "trailingMargin") to just "leading" (or "trailing")
  3. Reopen the storyboard in the designer and it should then show up correctly.

FYI, this doesn't appear to be an issue in Xamarin Studio, just VS.




回答2:


If you are using a macOS, you can use Xcode interface builder to achieve the same.




回答3:


I was able to resolve this in Visual Studio 2017 interface by doing the following:

  1. Set the constraints to the margin, like OP's image shows.
  2. Click on the newly added constraint in the designer so it's selected.
  3. In the Properties click the Widget tab and find the Layout Constraint section. One of the items under this section will have a Relative to Margin checkbox checked. Uncheck that, then set the Constant from its default (mine was 20) to 0.


来源:https://stackoverflow.com/questions/44269801/xamarin-ios-designer-cannot-constraint-to-super-view-edges

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!