Autoresizing issue in Xcode 8

2019-01-14 05:31发布

=== EDIT ========

This issue is now solved in Xcode 8.1. I have checked.

================

I don't know auto-layout properly. So, I am using autoresizing option in my all apps and it's fine for me. I am able to fulfill my all requirements by this without any issue.

Now in Xcode 8, I have migrated my old swift project to swift 3. Now issue arises.

Storyboard SS

See in image, I have set Autoresizing, and its working fine without issue in all devices until now and this project is live in AppStore, so that I can't show the UI or storyboard.

Now I have to do some update in project. So I am working in Xcode 8 now. But my autoresizing not working properly, as all the controls are come in center and UI is messed up.

Output image

And the issue persists in device also. I have checked in simulator and device as well. But problem is there also. Any suggestion and help will be appreciated. Thanks in advance.

EDIT:

Yesterday there is issue in runtime only, But Today storyboard also changed views like this image

Storyboard image

Which means the whole UI design is messed up. This is weird.

9条回答
够拽才男人
2楼-- · 2019-01-14 06:10

Solved by unchecking "Auto Resize Subviews" to ScrollView

enter image description here

查看更多
Summer. ? 凉城
3楼-- · 2019-01-14 06:11

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

查看更多
Ridiculous、
4楼-- · 2019-01-14 06:16

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!

查看更多
女痞
5楼-- · 2019-01-14 06:17

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,

enter image description here

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

enter image description here

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.

查看更多
贪生不怕死
6楼-- · 2019-01-14 06:18

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.

查看更多
一纸荒年 Trace。
7楼-- · 2019-01-14 06:20

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.

enter image description here

查看更多
登录 后发表回答