Autoresizing issue in Xcode 8

人走茶凉 提交于 2019-11-27 20:25:15

Facing same issue. As a my point of view this problem is occurred when we use autoresizing and set only inner autoresizingMask to any view controller. Like,

If we use also boundary autoresizingMask at that time not facing this issue. Like,

I don't know this is actual bug of xcode 8 or remove this functionality in xcode 8.

So, Finally my suggestion is that we need to use auto layout in xcode 8.

Hassy

Please try to uncheck autoresizing from xib or storyboard. And inviewDidLoad set [_scrollView setAutoresizesSubviews:YES];

Try it if this solve your problem

Edit: In case of storyboard uncheck Resize view from NIB option.

I'm not sure about storyboards but I've found a temporary solution for xib files. In Utilities panel (right hand panel) select File Inspector tab. Under Interface Builder Document section, select the file to open in "XCode 7.x". It will ask you to confirm that you do not want to use XCode 8 features, save the file and close it.

Sapana Ranipa

i also face same issue for scrollView in Xcode8

i have a one solution to work with scrollView

first take a simple UIView and add all component which you want add to in scrollView and give that component to autoSizing

and also take one scrollView and programatically set view frame and also set scrollView contentSize and add your view into scrollView

like wise, in my case i add this code in viewDidLoad for swift project

// add view to scrollview

self.scrollObjForNextAppointment.contentSize = CGSize(width:self.scrollObjForNextAppointment.frame.size.width,height:410)

self.viewForScrollContent.frame = CGRect(x:0,y:0,width:self.scrollObjForNextAppointment.frame.size.width,height:410)

self.scrollObjForNextAppointment.addSubview(self.viewForScrollContent)

it's work for me, Thanks!

Xcode 8 beta 2 solved this problem!! I already checkeded now!

Thippi

Solved by unchecking "Auto Resize Subviews" to ScrollView

Update the issue seems to have been fixed in Xcode 8.1


Having the same issue and I've found that the offender here is the UIScrollView element. Just move everything outside of your scroller and you will see that everything works just fine, like before.

Which means one possible workaround would be to place your scrollable content in an ordinary UIView, then replacing it with UIScrollView at run time, programmatically.

Michael Long

A moderator kindly deleted my answer here as a duplicate, so see my answer at:

Autoresizing under iOS 10 doesn't work

In response to max, yes, resizing a bunch of subviews can be a pain. That's why I suggested adding a single "content view" to the scroll view and moving all of your existing subviews inside of that view. Autosize the subviews inside of the content view just as you did with the scrollview, and autosize the content view to the scrollview.

It's that content view that you're then resizing inside viewDidLayoutSubviews.

And again, the "content view" inside of the scrollview construct is pretty much the standard way to get auto-sizing scroll views using autolayout, so it should be considered a best practice.

That method is described here...

https://spin.atomicobject.com/2014/03/05/uiscrollview-autolayout-ios/

My method seems a little convoluted, but I was able to patch up a storyboard with about a dozen scenes and Vc's in about 15 minutes. It would have taken much, much, much longer to rebuild everything using auto layout.

Thermometer

Apple just came out with XCode 8.2, which fixes this problem for me. I have been using XCode 7.3.1 for my interface design parallel to 8.1, but I can now use 8.2 without any problems.

The storyboard gets updated with widths and height of frames though, to accommodate the new 'View as:' functionality. Though it doesn't seem to affect running on device/simulator.

Curiously, the bugfix it is not noted in the XCode 8.2 release notes.

Original answer here

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