iOS15 new feature adaptation (warning: UITableView sectionHeader moves down by 22 pixels, and the spacing becomes higher)

1、UINavigationBar

In iOS 15, UINavigationBar is transparent by default. There will be a blur effect when swiping. If you want to always have a blur effect, you can achieve it by changing the scrollEdgeAppearance property.

Solution:

UINavigationBarAppearance*barApp=[[UINavigationBarAppearance alloc]init];

barApp.backgroundEffect=[UIBlurEffect effectWithStyle:UIBlurEffectStyleRegular];

self.navigationBar.scrollEdgeAppearance=barApp;

UINavigationBar, UIToolbar and UITabBar will use scrollEdgeAppearance when your VC's associated scroll view is at the appropriate edge (or if you don't have a UIScrollView in your view hierarchy, more on that below).

You must use UIBarAppearance API to customize. UIToolbar and UITabBar added the scrollEdgeAppearance property in iOS 15 for this.

Solution:

if(@available(iOS15.0,*)){

UINavigationBarAppearance*barApp=[UINavigationBarAppearance new];

barApp.backgroundColor=[[UIColor blueColor]colorWithAlphaComponent:0.5];

self.navigationController.navigationBar.scrollEdgeAppearance=barApp;

self.navigationController.navigationBar.standardAppearance=barApp;

}

2. iOS 15 UITableView sectionHeader moved down by 22 pixels

A new property has been added to UITableView in iOS 15: sectionHeaderTopPadding. This attribute will add a default height to each section header. When we use UITableViewStylePlain to initialize UITableView, the system will increase the section header by 22 pixels by default.

Solution:

if(@available(iOS15.0,*)){tableView.sectionHeaderTopPadding=0;}

3. Support for state programming: UICellConfigurationState; UICollectionViewCell, UITableViewCell all support block execution when the state changes.

4. UICollectionViewLayout supports automatic height; AutomaticDimension

5. JSON parsing supports json5

6. Add UISheetPresentationController, through which you can control the display size of UIViewController from Modal, and you can switch between different sizes by dragging gestures.

7. UIButton supports more configurations. UIButton.Configuration is a new structure that specifies the appearance and behavior of the button and its content. It has many properties related to button appearance and content, such as cornerStyle, baseForegroundColor, baseBackgroundColor, buttonSize, title, image, subtitle, titlePadding, imagePadding, contentInsets, imagePlacement, etc.

image.png

8. Introduce CLLocationButton for one-time location authorization. This content is built into the CoreLocationUI module, but if you need to obtain detailed location information, you still need to use CoreLocation.

9. URLSession launches an API that supports async/await, including data acquisition, upload and download

10. The system picture supports multiple layers and multiple rendering modes.

11. UIImage has added several resizing methods.


 

Guess you like

Origin blog.csdn.net/ZhaiAlan/article/details/121537148