We had to create a 64bit build of our application, due to iOS 11 enforcement. We've effectively done that but stuck in icons alignment in our XIB files.
In our old builds the icons used to appear like vertically aligned. But now the icons are appearing horizontally aligned with text. I have tried to set custom offsets, apply Auto Layout and Trait Variations from Interface builder Document properties.
How it appears as of now in other devices, this is the desired behavior as well:
How it appears right now:
It's the new feature of iOS 11 User Interface on iPad (refer to this WWDC talk).
I don't think you can do anything with standard exposed configuration options unless you use a custom component.
Or you can subclass and trick the component to think that it's always in compact size class as described here:
https://stackoverflow.com/a/45945937/1463411
Related
With the new iPhone X coming, are there any UI or UI Api changes required to fully support the iPhone X?
Are there any API changes that might affect the UIStatusBarStyle / UINavigationBar / UINavigationItem / UITabBar etc.
The only significant change I see is the larger display of 145pt longer.
The only information I could find is the Apple: Human Interface Guidelines
located here:
https://developer.apple.com/ios/human-interface-guidelines/overview/iphone-x/
For native IOS app the support is already given and all the info is available on full screen(18:9). Lots of app instead still need to fully support the new format so info available on 16:9 ratio
In order to get full-screen applications you will need to recompile your apps with IOS 11 / Xcode 9.
If you use Standard UI controls you should be safe. If you use Autolayout you can utilise the new "safeAreaLayoutGuide" which will then basically help your ui design to respect the iPhoneX view port.
I found this Transcript from Apple located here: https://developer.apple.com/videos/play/fall2017-801/?time=126
"On iPhone X, people access the app switcher (indicated by the red arrow) and the Home screen by swiping up anywhere along the bottom edge of the display. An indicator at the bottom of the screen offers a hint about this interaction.
This indicator is displayed over your app's interface. You'll need to account for this when designing your app. If your app uses UIKit controls and auto-layout, designing and developing for iPhone X and our other devices should be straightforward. Standard UIKit elements such as navigation bars, tables, and collection views, automatically adjust when viewed on iPhone X. Navigation bars, tab bars, and toolbars are positioned and scaled appropriately on all iOS devices. The navigation bar's background material is extended to the display's top edge, and the background material of the tab bar and toolbar is extended to the bottom, while the elements they contain are positioned to prevent underlapping or clipping by other elements."
Basically if you use standard UIKit you have nothing to worry about.
Although Apple recommends: "Make sure that your UI displays correctly and no elements are mispositioned, overlapping, incorrectly scaled, or clipped"
If you discover issues, use the safe area guides and layout margins to correctly position UI elements.
I'm using a storyboard with some compoments like labels and buttons. The problem is that the captions are too big for my mobile display so the last words will be cutted.
I noticed that the font size seems a little bit bigger than in other apps so I want to ask what the default font size is?
And if I reduce the font, however, there may be problems on various devices, e.g. the presentation on an iPhone or an iPad?
Is it necessary to create different storyboards, each one for every device or what is the usual procedure?
There is an option called "minimum font scale" which may be useful, and there is this built-in functionality to adapt your UI to different devices:
https://developer.apple.com/library/content/featuredarticles/ViewControllerPGforiPhoneOS/TheAdaptiveModel.html#//apple_ref/doc/uid/TP40007457-CH19-SW1
And a tutorial from a site that has helped me wrap my head around a lot of iOS concepts (this is the one I used, got updated for ios11)
https://www.raywenderlich.com/162311/adaptive-layout-tutorial-ios-11-getting-started
Solution With Xcode 9:
Xcode story board has an options to separate configuration for User Interface Elements for different size (iPad & iPhone) and different orientation (Landscape and Portrait), which are Any, Compact, Regular integrated with Size Class.
Size class also allows to set different font size for iPhone & iPad.
Follow these steps, for easy under standing, how to use Size class to solve your problem.
Add label in your story board - view controller layout
Select label and open 'Attribute Inspector'
There is a small '+' icon on left side of 'Font' attribute. Click on '+' icon. It will give you a small popover with size options for your label font.
For iPhone it will show you compact width and regular height by default set/selected. Now change/set height and width both as Regular and Click on 'Add Variation', which will add a new variation for font size for iPad (a device with regular height and width).
Change font size from 17 to 40 for variation with 'wR x hR' (As shown in this snapshot)
Here is result of variation in iPhone and iPad
Instead of having to use xcodes constraints, which I can never get to work right, is there a way to manually set where UI elements are on the screen? I noticed that if I'm on the attributes bar for the view controller, I can set simulated metrics's size to any iphone size I want.
Then I can position the UI elements on the screen where I please. When I build and run, it always mimics exactly what I set up. However, it only works for the particular size of the iphone I specified. Is there a way to do all the sizes manually without making several xcode projects?
Thanks!
There is multiple other solution that is not as good as constraints.
1) Use frame property of views to place them
2) Use size classes to do different placement for iPad iPhone etc
3) Use suggested constraints - you are placing views and than you can give XCode possibility to create constraints for you suggesting what you want from your views placement.
You're going to want to learn how to properly use constraints. The approach you're trying to do would have been okay when there was only one screen size, but now we have three different sizes of iPad, two watch sizes and four different iPhone sizes. Here's a link to a tutorial from Ray Wenderlich (he has some pretty good tutorials to get you started n a wide variety of things). https://www.raywenderlich.com/115440/auto-layout-tutorial-in-ios-9-part-1-getting-started-2
The auto layout in storyboard on Xcode 7 isn't my favorite, but when Xcode 8 comes out it provides device specific sizes for views that makes auto layout much easier. So maybe Xcode 8 will provide a better solution to your problem!
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.
Go to file inspector and uncheck the "use size classes" option, this is due to newly introduced size class feature to support all devices in 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
Select your view controller and find size inspector, Change fixed to freeform and give whatever size you want
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...
I could not figure out why this is happening.I searched here but could not find any answer for this.
The problem is I developed some screens using StoryBoard in xcode 4 and ios 6 but now I upgraded to xcode 5 and ios 7.But after upgrading all my labels,text fields have changed dimensions.Their x,y co-ordinates have changed along with width and height.They all have same x,y co-ordinates(0,758) and width,height as 0,0.
I can bring them back manually editing but there are too many fields to do so.
Is there anyway to do it easily?
Recommendation
From your problem description it sounds like you're seeing the effects of the deep system changes in iOS7.
To verify that you are not seeing any bugs please select your storyboard or xib file (this works on both) and open the assistant editor.
Next choose the Preview as the assistant editor. This will show you the storyboard layout as it will look on your device.
Note the menu on the lower right will show three things:
The version of iOS being previewed
A rotation control to show the controls in different orientations
A height control to show how the view will look at 3.5/4.0 heights
iOS7 Preview
iOS6 Preview
Please keep in mind that the iOS7 control sizes are different from all other prior versions of iOS so they will never line up precisely. Use of auto layout will need to be re-examined if your app is highly complex: There are two options: Review the auto layout guide (here) or turn it off (in the file attributes inspector) and use the old springs and struts (autosizing).
I recommend a thorough reading of Apple's transition guide (link) to make sure you understand the impact of the changes to the UI controls.
Techtopia has a good article on iOS7 Auto Layout which can be very useful in managing the sizing and appearance of UI Controls (link).
Apple has a sample app that I think is worth examining called UICatalog (link). I recommend downloading the app and running it on your simulator to see how the new controls will look. Note that the sample does not have auto layout constraints active, if you choose to continue using auto layout you may want to consider defining your layout with the Visual Formatting Language (link).
Other things to consider
There were some bugs with the early build of storyboard in Xcode 5
and auto layout was changed significantly, please make sure you
download the absolute latest version of Xcode.
You could try cut and paste the objects in Xcode.
You should verify that the auto layout setting is consistent between
versions (either on/off in the file inspector).
Check that your auto layout constraints are not generating a warning
or error in Xcode. If they are you will need to Update All
Constraints.
Make sure you have git turned on before starting so you can rollback
your changes to a known state.
Hope some of these suggestions will be helpful.