Leading space to safe area , instead of saying top margin in Xcode 9? - xcode-storyboard

I am getting this new feature in Xcode 9. I am attaching the snapshot for the same. What does the safe area mean, in Xcode 9.

Safe Area
Apple says is the portion of your view that is unobscured by bars and other content. Source: Apple - safeAreaLayoutGuide
My explanation:
It is the guide for iPhone X for you to avoid the top notch and the bottom part for the swipe gesture that replaced the home button
Here is a visual image for clarity:

Related

Trouble auto sizing iPhone 5 storyboard to fit iPhone 6

I have developed an app using iPhone 5 storyboard. The storyboard contains many views and I haven't used any constraints on any of the views.
What I am trying to achieve is to make the iPhone 5 storyboard expand to fit on iPhone 6 and 6+ without the need for any constraints, is this possible?
I have read many answer on SO already which lead me to believe that it is possible to get it to work but have not yet succeeded.
I don't have any launch images set, and I ticked the 'Use Size Classes' box for the storyboard.
Why is the storyboard not auto sizing for the iPhone 6. It's driving me crazy.
I hope you can help me,
thanks.
Have you tried using the Autoresizing feature? Uncheck the size classes box and you will see the option to use autoresizing under the measurements section to resize your storyboard for the 6 and 6plus.
http://i.stack.imgur.com/qM4Vu.png
You wont have to use size constraints since you're only making it for the iPhones
Click the "Use Auto Layout" checkbox shown below
Also here is a link to the size of the Launch images you should be using for the 6 and 6 plus.
One way but not recommended. Don't add splash screen for 6 and 6+
If you don't add the splash screen for 6 and 6+ OS will automatically scale all your UI.
The default auto resizing masks, which you probably have, have a fixed top and left margin and a fixed height and width. This would give you all the views packed into the top left corner as you are seeing - the flexibility is all in the right and bottom margins.
You're seriously better off using constraints (even adding the default constraints will probably get you most of the way there) but if you insist on sticking with auto resizing, you need to set fixed left and right margins and flexible width. Height is a bit more difficult, you have to decide which elements will fill the extra space and have flexible height on those.
To ensure that your app supports multiple screen sizes (instead of just scaling up the smaller interface) you should add a launch image .xib file which is much easier than using lots of images.

How to upload 60x60 tab bar icon in IOS

I'm using XCode 6.1 and have uploaded 30x30 icons for my tab bar icons. But of course I should be able to upload 60x60 for higher res ones, right? But for the life of me I can't figure out where the option for that is in the upper right corner of the editor. I only see the option to choose one image. Can anyone help me?
Thank you in advance,
Brent
First of all you really need to include up to 3x images now for iPhone 6 plus
Add your images for your tab bar icons to your project eg:
tabBarIcon.png, (30x30)
tabBarIcon#2x.png, (60x60)
tabbarIcon#3.png (90x90)
Then in XCode editor select tabBarIcon.png and at runtime the correct image size will be selected for the device you're targeting

How can I support a split view in landscape on the iPhone 6 or 5s?

In my app there's a lot of wasted space in landscape on the iPhone 6, and to a lesser extent even on 4" screens. I'm already using iOS 8's UISplitViewController changes to support the two-pane view in landscape on the iPhone 6 Plus, but it'd be useful to see both panes on some smaller devices as well.
Conveniently Apple had a WWDC 2014 session, "Building Adaptive Apps with UIKit" which included details on exactly how to do this. You can download the sample code here, but in short: they put the UISplitViewController inside of a UIViewController subclass. The subclass uses setOverrideTraitCollection:forChildViewController: to force [UITraitCollection traitCollectionWithHorizontalSizeClass:UIUserInterfaceSizeClassRegular] on the split view when it considers the width wide enough. At the time the sample code worked well, and still does on most devices.
However after attempting to use this code in my own app, I discovered it fails horribly on the iPhone 6 Plus. You can see this yourself if you download the sample code and make two changes:
Add a storyboard, add an empty view controller to that, and set it as the "Launch Screen File". This is necessary to run the app at its native resolution on the 6 Plus.
In AAPLTraitOverrideViewController.m, change line 21 to size.width > 500.0, or anything greater than 414. This is necessary to ensure the split view only shows a single view in portrait on the 6 Plus.
Now you can run the app in the simulator. To see the problem, just do this:
Rotate the device to landscape (command-right arrow)
Rotate it immediately back to portrait (command-left arrow)
You can already see that something's not right. All of the table cells should have an arrow on the right side in portrait, but they don't. They're behaving like they're still in a split view. If you tap one of those rows, it gets worse—the detail view slides up from the bottom, and the navigation bar is gone.
I think there must be a bug in iOS 8 here that's causing the problem. But since this code was shared before the iPhone 6 Plus was announced, it also seems possible that it just needs some adjustments to make it compatible with that device. So far the only solution I've found is to change line 21 to something like if (size.width > 500.0 && size.width < 736.0) but I don't want to use code that could break again the next time Apple introduces a new screen size. Is there a better way to handle this?
Seems like you'll always want to make the horizontal size class regular (UIUserInterfaceSizeClassRegular). To do this, override traitCollectionDidChange:. In this method, if the vertical size class is compact (suggesting it's likely in landscape), override the trait collection so that the horizontal size class is regular.
UITraitCollection *compactHeight = [UITraitCollection traitCollectionWithVerticalSizeClass:UIUserInterfaceSizeClassCompact];
if ([self.traitCollection containsTraitsInCollection:compactHeight]) {
UITraitCollection *regularWidth = [UITraitCollection traitCollectionWithHorizontalSizeClass:UIUserInterfaceSizeClassRegular];
self.forcedTraitCollection = [UITraitCollection traitCollectionWithTraitsFromCollections:#[self.traitCollection, regularWidth]];
[self setOverrideTraitCollection:self.forcedTraitCollection forChildViewController:_viewController];
} else {
[self setOverrideTraitCollection:nil forChildViewController:_viewController];
}
However, if you'll want more specific behavior, you'll have to rely on canvas size for app-specific behavior.

Any way to restore 3D effect and/or shading to UIPopoverController?

The recent release of iOS 7 includes a change to UIPopoverController where the popovers are now flat, with no shading underneath (none of the betas for iOS 7 included this change - the change only appeared with the GM release). Unfortunately this change is really not working with our iPad application; without the shading effect and the dark border, our popover is blending in with the underlying screen.
Do I have any options at all as far as customizing this effect or (even better) making popover look the way it used to look?
Take a look at popoverBackgroundViewClass. Not sure this will give you the result you are looking for, however. When a popover is displayed, the system dims the background view hierarchy, but there are no shadows underneath the popover. If this is not enough, you should look at implementing a custom popover controller or using an open source.

Unicode characters being drawn differently in iOS5

Setting the title of a uibutton to u25C0 causes it to have a blue background in iOS5 but not in iOS4.3.
Strangely enough setting the title to u25C2, 2 characters a head in line, appears as expected. Go fig. I will be attaching an image later.
As a side note is this blue button currently in use in any Apple apps?
Thanks.
Left : iOS 5
Right : iOS 3.2
This was done by setting the title to the unicode character stated earlier.
You can try to use Unicode6.1's variation selector. For about Emoji, adding "\U0000FE0E" to specify non-coloured glyph.
For example, for about left-triangle(U+25C0), you can specify like #"\U000025C0\U0000FE0E", and that changed glyph from Apple Color Emoji style to non-colored plain emoji, at least on
iOS6 simulator on Mountain Lion.
Swift 4.0
let glyph = "\u{000025C0}\u{0000FE0E}"
You need to set the font appropriately. The blue icon you're seeing is U+25C0 in the Apple Color Emoji font. I'm not sure what other fonts on iOS include the symbol you want, but if you find that font and set it explicitly then it should render the icon you want.
Just found how to achieve this without code. Open Symbols&Emoji panel by clicking near your country flag in top right corner of OSX screen.
Type symbol you wanna find
Double-click on symbol you found
You will see it appear in text filed
Press Enter and you will see emoji in Xcode IB
Type "variation" keyword in search field
Double click on variation selector symbol
Sure it is "VARIATION SELECTOR-15" exactly
Nothing will changed in textfield (don't worry)
After pressing Enter Xcode IB will changed to flat emoji!