iOS13简单适配

软件环境

Xcode11 + iOS13

问题列表

Q1:present 不全屏

问题描述:viewController present 的时候,默认没有全屏。

手势解锁页面没有全屏

UIModalPresentationStyle枚举
public enum UIModalPresentationStyle : Int {
    case fullScreen

    @available(iOS 3.2, *)
    case pageSheet

    @available(iOS 3.2, *)
    case formSheet

    @available(iOS 3.2, *)
    case currentContext

    @available(iOS 7.0, *)
    case custom

    @available(iOS 8.0, *)
    case overFullScreen

    @available(iOS 8.0, *)
    case overCurrentContext

    @available(iOS 8.0, *)
    case popover
  
    @available(iOS 7.0, *)
    case none
  
    @available(iOS 13.0, *)
    case automatic
}
原因:

默认没有设置modalPresentationStyle , iOS13之前,modalPresentationStyle 的默认值是 .fullScreen,iOS13中默认值是 .automatic(参见下文中的Discussion)

  • iOS13: The default value for this property is UIModalPresentationStyle.automatic.
  • <iOS13: modal view controllers are always presented full-screen
// 苹果官方文档
// The presentation style for modally presented view controllers.
var modalPresentationStyle: UIModalPresentationStyle { get set }
 
// Discussion(Xcode11)
The presentation style determines how a modally presented view controller is displayed onscreen. In a horizontally compact environment, modal view controllers are always presented full-screen. In a horizontally regular environment, there are several different presentation options.
The default value for this property is UIModalPresentationStyle.automatic. For a list of possible presentation styles, and their compatibility with the available transition styles, see the UIModalPresentationStyle constant descriptions.
// ***********************************************************************************************
//  Discussion(Xcode9)
The presentation style for modally presented view controllers.
The presentation style determines how a modally presented view controller is displayed onscreen. In a horizontally compact environment, modal view controllers are always presented full-screen. In a horizontally regular environment, there are several different presentation options. For a list of possible presentation styles, and their compatibility with the available transition styles, see the UIModalPresentationStyle constant descriptions.

Q2:UISearchDisplayController在iOS13上闪退

问题描述:在老版本Xcode(<Xcode11)的StoryBoard中拖拽一个UISearchBar控件,当前控制器中会自动附属上UISearchDisplayController,然而UISearchDisplayController在iOS13以后已过时,所以闪退

UISearchDisplayControllerUISearchDisplayController

原因:

通过Bugly分析,得知原因

疑问:

在本地真机调试(Debug | Release),iOS13设备上未出现闪退,在TestFlight中闪退,Why ???

Q3:Dark模式

问题描述:由于上线比较紧急,就简单粗暴的“适配”了Dark模式:

全局关闭Dark模式
在Info.plist中,将User Interface Style 的值设置为 Light


其他:来源于互联网

Q4: 私有KVC

问题描述:在使用iOS 13运行项目时,使用KVC修改私有属性,会闪退

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值