preface

Mid-Autumn festival after a long holiday to go to work, I made a boiling point to ridicule their daily work day:

To be honest, September can be a frustrating time for iOS development. In addition to daily feature iterations and bug fixes, we also need to adapt to the new iOS.

My own WanAndroid client project, the page and logic is very simple, so it is faster to adapt, to share with everyone.

NavigationBarandTabBarIt’s all transparent

NavigationBar and TabBar are both transparent. In order to facilitate UI observation, Light mode is used.

Immediately looked up the problem and started fixing it:

Private func iOS15NavigationBarAndTabBarClearFix () {# if available (iOS 15.0, *) { let navBarAppearance = UINavigationBarAppearance() navigationController? .navigationBar.scrollEdgeAppearance = navBarAppearance let tabBarAppearance = UITabBarAppearance() tabBarController? .tabBar.scrollEdgeAppearance = tabBarAppearance } }Copy the code

Because it’s an open source project, I didn’t do much customization for NavigationBar and TabBar. I used the default Settings, so I didn’t do much configuration for navBarAppearance and tabBarAppearance page numbers. Just were assigned to the navigationBar. ScrollEdgeAppearance and tabBar scrollEdgeAppearance is finished.

However, the scrollEdgeAppearance and related attributes did not make people understand after reading the annotations for a long time. I would be very grateful if someone could give me some advice:

/* Fallback Behavior: 1) Appearance objects are used in whole -- that is, all values will be sourced entirely from an instance of UINavigationBarAppearance defined by one of these named properties (standardAppearance, compactAppearance, scrollEdgeAppearance, compactScrollEdgeAppearance) on either UINavigationBar (self) or UINavigationItem (self.topItem). 2) The navigation bar will always attempt to use the most relevant appearance instances first, before falling back to less relevant ones. The fallback logic is: AtScrollEdge: self.topItem.scrollEdgeAppearance => self.scrollEdgeAppearance => self.topItem.standardAppearance => self.standardAppearance AtCompactScrollEdge: self.topItem.compactScrollEdgeAppearance => self.compactScrollEdgeAppearance => self.topItem.scrollEdgeAppearance => self.scrollEdgeAppearance => self.topItem.compactAppearance => self.compactAppearance => self.topItem.standardAppearance  => self.standardAppearance CompactSize: self.topItem.compactAppearance => self.compactAppearance => self.topItem.standardAppearance => self.standardAppearance NormalSize: self.topItem.standardAppearance => self.standardAppearance */ /// Describes the appearance attributes for the navigation Displayed with its standard height. @available(iOS 13.0, *) @NSCopying open var standardAppearance: UINavigationBarAppearance /// Describes the appearance attributes for the navigation bar to use when it is displayed With its compact height. If not set, the standardAppearance will be used instead. @available(iOS 13.0, *) @NSCopying open var compactAppearance: UINavigationBarAppearance? /// Describes the appearance attributes for the navigation bar to use when an associated UIScrollView has reached the edge abutting the bar (the top edge for the navigation bar). If not set, A modified standardAppearance will be used instead. @available(iOS 13.0, *) @nscopying open var scrollEdgeAppearance: UINavigationBarAppearance? /// Describes the appearance attributes for the navigation bar to use when it is displayed with its compact heights, and an associated UIScrollView has reached the edge abutting the bar. If not set, first the scrollEdgeAppearance will be tried, And if that is nil then compactAppearance followed by a modified standardAppearance. @available(iOS 15.0, *) @NSCopying open var compactScrollEdgeAppearance: UINavigationBarAppearance?Copy the code

Here’s what it looks like after the change:

UITableView’s sectionHeaderView is higher

See the development environment, the top of the space is quite empty, there is this problem:

Here’s where the problem starts. Here’s the code from UITableView:

/ / / Padding above each section header. The default value is ` UITableViewAutomaticDimension `. @ The available (iOS 15.0, *) open var sectionHeaderTopPadding: CGFloatCopy the code

IOS 15 one more sectionHeaderTopPadding attribute, and the default height is UITableViewAutomaticDimension.

In this case, just set sectionHeaderTopPadding to 0:

# if available (iOS 15.0. *) {tableView. SectionHeaderTopPadding = 0}Copy the code

Put this code where the SectionHeaderView needs to be used, and change it to look like this:

Reference documentation

IOS15 adaptation

conclusion

For iOS 15, my WanAndroid client is just that, but each App has its own complexity and challenges.

My personal experience is as follows:

  • Write a good base class, some problems in the base class changed, all pages naturally good, do not have to change a page. On the importance of writing base classes.

  • Fix it first and then figure out why. Users won’t understand you that much.

  • Prioritize your problems. Fix the ones that crash and severely affect your experience first. The rest can be fixed over time.

  • Patience, adaptation of the problem, certainly not a, over a period of time, the online nature back to all kinds of solutions, this needs a certain amount of time.

We’ll see you next time.

Currently RxSwift written wanAndroid client has been open source –Project link.

It’s now available on iOS 15.

Remember to give a star!

Attached is an effect picture: