Autoresizing not working in iOS11 / XCode 9

自闭症网瘾萝莉.ら 提交于 2019-12-03 04:18:20

I'm working on this same issue today: one thing that has worked in some cases is swapping out for similar (but not identical) mask values. For example, one of our views didn't work with UIViewAutoresizingFlexibleHeight but it works with UIViewAutoresizingFlexibleBottomMargin.

I'm not aware of an automatic way to upgrade to AutoLayout - I actually use AutoLayout a lot in other projects, and the conceptual basis is pretty different...

I'll edit this answer if I find anything better.

Same issue here. As mentioned by @John Nimis playing with masks sometime seems to solve the problem. For example, when we had both top and bottom masks (UIViewAutoresizingFlexibleTopMargin| UIViewAutoresizingFlexibleBottomMargin) we got success removing the Top one.

EDIT I don't know if this is a definitive solution, but I noticed everywhere the issue happened I had a fixed origin (x or y) on the frame. For example:

view.frame=(view1.frame.origin.x, 150, width, height);

Changing the fixed value in a relative value (for example respect to another view1) solved the issue with masks:

view.frame=(view1.frame.origin.x, view1.frame.origin.y+view1.frame.size.height+20, width, height);

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