简体   繁体   中英

iOS simulator screen size

It is just 2days to start iOS programming.

So I'm very beginner in this area.

在此处输入图片说明 <--This image is in iOS simulator. As you see right part is cropped.

在此处输入图片说明 <--This image is original UI.

I don't know why some parts have gone.

I am using MacBook Pro 2011 with Yosemite OS and brand-new XCode.

I tried cmd+1, cmd+2, cmd+3.

Please help me.

Thank you in advance.

转到文件检查器,然后取消选中“使用尺寸类别”选项,这是由于新引入的尺寸类别功能可支持ios 8中的所有设备

The new user interface works with all sizes of devices at once. The default size is 600x600 as you are seeing. When you simulate, is uses autolayout and constraints to arrange objects for the desired screen, aka an iPhone. If you want to place the label in the center of the screen, Ctrl+drag from the label to the background, release mouse and buttons and the constraints options will appear. Click Center Horizontally in Container and Center Vertically in Container. Run again. It will be centered.

Best regards

选择您的视图控制器并找到尺寸检查器,将“固定”更改为“自由格式”并提供所需的任何尺寸

I had a closely related question, and Mehul Thakkar's answer helped me to get where I needed to be, but I'm adding a new answer to flesh out both the question and answer a bit.

I was working on an iPhone app for iOS 8 that was shrinking the interface on larger screens to the size of the iPhone 4s. I don't use storyboards or Interface Builder nib/xib files at all, and do everything programmatically; for iOS 7 and earlier, I didn't bother making an explicit launch screen as my UI was simple enough that it loaded very quickly and a launch screen wasn't necessary.

Anyway, after finding this page and poking around a bit, it appears that creating a launch screen storyboard or nib/xib is now necessary on iOS 8, if you want your application to run at the correct size? (At least, I couldn't find any other way to coerce Xcode to do it in the project settings or whatnot.)

To do this, I created a new launch screen .xib file, unchecked "Use Size Classes" in the "Interface Builder Document" section of the File Inspector of that .xib file, and set the "Launch Screen File" under the General tab of my target settings to use that .xib. After that, the app ran at full screen size again.

This works for me and I guess I don't mind putting in a few minutes to turn the .xib file into a proper splash screen, but I'd be interested in hearing if there are other/better ways of making things work in iOS 8 and beyond, for those of us who hate our lovely code being tainted by the presence of those nasty storyboards/nibs/xibs...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM