iOS: add constraints between a xib view and its superview

僤鯓⒐⒋嵵緔 提交于 2019-12-13 07:51:17

问题


I'm adding a view from a xib file to a table view controller and then placing this out of view so that when the user taps a button the view scrolls down from under the navigation bar to be visible. Here's the view that drops down:

This works fine on iPhone 6 but anything smaller and the drop down view loses its constraints and looks all jumbled up like below:

I believe this is the case because there are no constraints being set between the drop down view and the table view (the superview). I was using PureLayout however since iOS8.3/Xcode 6.3 this doesn't seem to do anything anymore.

What options do i have for adding a constraint to drop down view so it is aligned with the top, left and right edges of the superview?

Thanks


回答1:


Solved: I ended up just setting the frame of the xib view manually upon creation for the different screen sizes



来源:https://stackoverflow.com/questions/29711012/ios-add-constraints-between-a-xib-view-and-its-superview

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