iOS 14适配小总结

1. iOS 14 popToRootViewControllerAnimated 底部tabbar消失

iOS14 missing TabBar on popping multiple ViewControllers
Seems like there is a confirmed bug on Xcode12 + iOS14.
I have a UINavigationController on each item of a UITabBar, and I've set hidesBottomBarWhenPushed to YES on every secondary ViewControllers, so the TabBar will only be shown on the rootViewController of navigationController. But when I try popping multiple ViewControllers, like pop C from stacks like A-B-C, I found that the TabBar just missing on A.
Also another weird part, when I print navigationController.viewControllers in viewWillDisappear: method on C, I found it printing like "C-A". How C moved to the top of the array??
This is confirmed on a simple demo app, wonder when it will be fixed.
https://developer.apple.com/forums/thread/660750

修改方法:

- (NSArray *)popToRootViewControllerAnimated:(BOOL)animated {
   if (self.viewControllers.count > 1) {
    self.topViewController.hidesBottomBarWhenPushed = NO;
  }
   
  NSArray *viewControllers = [super popToRootViewControllerAnimated:animated];
  // self.viewControllers has two items here on iOS14
  return viewControllers;
}

或者

[UINavigationController popToRootViewControllerAnimated:NO]

该问题在iOS 14.2中已修复。

2. UIDatePicker

preferredDatePickerStyle = UIDatePickerStyleWheels

3. 图片新增“Limited Photo Library Access” 模式

iOS 14使用PHPhotoLibrary获取图片库

4. 屏幕尺寸适配

iPhone屏幕尺寸、statusBar、navigationBar、tabBar高度对比
iOS使用宏定义代码块获取状态栏高度

5. UITableViewCell

iOS14推荐使用

[cell.contentView addSubview:];

方式添加控件。
因为UITableViewCell中使用

 [cell addSubview:]

方式添加的控件,会显示在contentView的下层,控件会被contentView遮挡并无法响应交互事件。
搜索的时候使用search scope会更方便。
Xcode上手之搜索功能 https://blog.csdn.net/weixin_42414576/article/details/103971926

搜索的时候使用search scope会更方便

6. Xcode升级

Xcode Simulators 快速下载&安装 技巧

7.iOS 14 UIPageControl升级适配

iOS 14 UIPageControl升级适配

你可能感兴趣的:(iOS 14适配小总结)