It seems that a "Safe area layout guide before ios 9".
error will occur if I trigger the Use Safe Area Layout Guides
in the least XCode, does it means supporting both devices is not possible? Any advice? Thanks.
The iOS 15 will be compatible with iPhone SE (1st generation), iPhone SE (2nd generation), iPhone 6s, iPhone 6s Plus, iPhone 7, iPhone 7 Plus, iPhone 8, iPhone 8 Plus, iPhone XR, iPhone X, iPhone Xs, iPhone Xs Max, iPhone 11 Pro, iPhone 11 Pro Max, iPhone 11, iPhone 12, iPhone 12 mini, iPhone 12 Pro, iPhone 12 Pro Max, ...
Get the latest software updates from Apple The latest version of iOS and iPadOS is 15.6.1. Learn how to update the software on your iPhone, iPad, or iPod touch. The latest version of macOS is 12.5.1. Learn how to update the software on your Mac and how to allow important background updates.
It is totally possible to support iPhone X with a minimum target of iOS 8. (In fact, that's what we currently have in the Khan Academy app.)
What we do is apply the safeAreaInsets
in our Swift code using the #available
function, like so:
public override func safeAreaInsetsDidChange() {
if #available(iOS 11.0, *) {
super.safeAreaInsetsDidChange()
self.contentCatalogHeaderView?.safeAreaInsetsTopOverride = safeAreaInsets.top
self.collectionViewLayout.safeAreaInsetsTop = safeAreaInsets.top
}
}
From your question, it sounds like you're debating whether to use the checkbox in a Storyboard to enable safe area insets. I'm not sure whether it's possible for a Storyboard to support iOS 8 if safe area insets are enabled (I suspect it's not possible). However, you can always store a reference to a layout constraint, and update its constant in your code using the above #available
function.
(In Objective-C, the code looks nearly identical, just format it like this:
- (void)viewSafeAreaInsetsDidChange {
if (@available(iOS 11.0, *)) {
[super viewSafeAreaInsetsDidChange];
[self.view setNeedsLayout];
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With