iOS13中presentViewController的问题
iOS13中presentViewController的问题
更新了Xcode11.0 beta之后,在iOS13中运行代码发现presentViewController和之前弹出的样式不一样。

会出现这种情况是主要是因为我们之前对UIViewController里面的一个属性,即modalPresentationStyle(该属性是控制器在模态视图时将要使用的样式)没有设置需要的类型。在iOS13中modalPresentationStyle 的默认改为UIModalPresentationAutomatic,而在之前默认是UIModalPresentationFullScreen。
/*
Defines the presentation style that will be used for this view controller when it is presented modally. Set this property on the view controller to be presented, not the presenter.
If this property has been set to UIModalPresentationAutomatic, reading it will always return a concrete presentation style. By default UIViewController resolves UIModalPresentationAutomatic to UIModalPresentationPageSheet, but other system-provided view controllers may resolve UIModalPresentationAutomatic to other concrete presentation styles.
Defaults to UIModalPresentationAutomatic on iOS starting in iOS 13.0, and UIModalPresentationFullScreen on previous versions. Defaults to UIModalPresentationFullScreen on all other platforms.
*/
@property(nonatomic,assign) UIModalPresentationStyle modalPresentationStyle API_AVAILABLE(ios(3.2));
要改会原来模态视图样式,我们只需要把UIModalPresentationStyle设置为UIModalPresentationFullScreen即可。
ViewController *vc = [[ViewController alloc] init];
vc.title = @"presentVC";
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
nav.modalPresentationStyle = UIModalPresentationFullScreen;
[self.window.rootViewController presentViewController:nav animated:YES completion:nil];

私有KVC
在使用iOS 13运行项目时突然APP就crash掉了。定位到的问题是在设置UITextField的Placeholder也就是占位文本的颜色和字体时使用了KVC的方法:
[_textField setValue:[UIColor redColor] forKeyPath:@"_placeholderLabel.textColor"];
[_textField setValue:[UIFont systemFontOfSize:14] forKeyPath:@"_placeholderLabel.font"];
可以将其替换为
_textField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"姓名" attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14],NSForegroundColorAttributeName:[UIColor redColor]}];
并且只需要在初始化的时候设置attributedPlaceholder即富文本的占位文本,再重新赋值依然使用placeolder直接设置文本内容,样式不会改变。(想要这种效果的话需要在初始化attributedPlaceholder时的字符串不为空)
Universal Link(通用链接)
在Xcode11中配置Universal Link(通用链接)步骤:

在iOS13之前在其他APP去safari中打开
Universal Link(通用链接)系统匹配域名是全匹配,而在iOS13之后规则发生了变化,猜测是包含关系。比如在iOS13之前,如果Universal Link(通用链接)为w.mydomain.com那么在微信或者其他APP访问www.mydomain.com然后点击去safari打开则不会拉起相应APP,而在iOS13则会拉起相应APP。
而在safari中输入的链接则依然和iOS之前一样,只有www.mydomain.com才会提示打开相应APP。
修改APP名称(修改DisplayName值)
- 在Xcode创建项目时默认的
project.pbxproj中的所有PRODUCT_NAME = "$(TARGET_NAME)";。 - 在Xcode11.0之前如果修改
DisplayName时只是修改info.plist中的Bundle display name值,但是在Xcode11.0中修改该值则会把project.pbxproj中的一个PRODUCT_NAME改为修改后值,如果在项目中通过[NSBundle mainBundle] infoDictionary]取kCFBundleExecutableKey的就会有影响,并且对Build Settings中的Packaing中的一些名称有影响,可能还会有其他影响有待关注。
持续更新中·····
文章若有不对地方,欢迎批评指正
iOS13中presentViewController的问题的更多相关文章
- 升级xcode11&ios13的坑
Swift Packages 目前Pod跟SPM的兼容还没做好,配置好SPM后,Pod不能进行正常更新,先配置好Pod再集成SPM则没有问题 Pod以后的更新可能会解决这个问题,也会有越来越多的库支持 ...
- Xcode11: 删除默认Main.storyBoard, 自定义UIWindow的变化 UIWindow 不能在AppDelegate中处理
Xcode自动新增了一个SceneDelegate文件,查找了一下官方文档WWDC2019:Optimizing App Launch 发现,iOS13中appdelegate的职责发现了改变: iO ...
- 在Xcode11上开发“面向低于iOS13版本的App”时的一些注意点
相关知识: https://blog.csdn.net/BUG_delete/article/details/103699563 'AppDelegate' is only available in ...
- iOS - 适配 iOS 13 之工兵连扫雷
iOS 13 支持适配的机型 目前最新 iPhone 11.iPhone 11 Pro和iPhone 11 Pro Max iPhone X.iPhone XR.iPhone XS.iPhone XS ...
- ios8调用相机报警告: Snapshotting a view that has not been rendered results in an empty snapshot. Ensure you(转)
我这也报了这个警告,但按他的方法并没有起作用,把写到这个地方看是否其他人用的到 错误代码:Snapshotting a view that has not been rendered results ...
- iOS 唤起APP之Universal Link(通用链接)
什么是Universal Link(通用链接) Universal Link(通用链接)是Apple在iOS9推出的一种能够方便的通过传统HTTPS链接来启动APP的功能,可以使用相同的网址打开网址和 ...
- [其它]iOS 13 正式版发布 iPhone 6s或更新型号均可升级
苹果今天(2019.09.20)发布了 iOS 13 正式版,可以升级的设备包括 iPhone 6s 或更新型号.第七代 iPod Touch. iOS 13 推出深色模式,为 iPhone 带来截然 ...
- xcode11新项目删除main.storyboard 两种方法
方法一 心急的童鞋按照老操作完成后再按照如下操作即可 /** 弃用storboard 1.info.plist去除 <key>UIApplicationSceneManifest</ ...
- Xcode11.1 踩坑备忘录
Xcode11.1 踩坑备忘录(mac系统10.15) 1 .环信ChatDemo2.0报错 这是环信ChatDemo2.0报错 NSInteger numberOfBeforeSection = [ ...
随机推荐
- TestNg依靠先进的采用强制的依赖,并依赖序列的------TestNg依赖于特定的解释(两)
原创文章,版权所有所有,转载,归因:http://blog.csdn.net/wanghantong TestNg使用dependsOnGroups属性来进行依赖測试, 測试方法依赖于某个或某些方法, ...
- JQuery 判断checkbox是否选中,checkbox全选,获取checkbox选中值
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- iOS 自定义UIButton
工作中有一个点击button更新button上文案的需求,用自定义了button可以很简单的实现的这个需求 首先写个自定义的button CustomButton.h #import <UIKi ...
- redis入门笔记(3)
本篇文章介绍几个redis的应用场景. 1.取最新N个数据的操作 –比如典型的取你网站的最新文章,通过下面方式,我们可以将最新的5000条评论的ID放在Redis的List集合中,并将超出集合部分从数 ...
- Android之Log封装
blog原文地址:http://yuxingxin.com/2015/10/26/AndroidLog/ Github:https://github.com/fallblank/CodeEssay
- EF日志记录,包括记录Linq生成的Sql
<interceptors> <interceptor type="System.Data.Entity.Infrastructure.Interception.Datab ...
- 关于联合体union的详细解释
1.概述 联合体union的定义方式与结构体一样,但是二者有根本区别. 在结构中各成员有各自的内存空间,一个结构变量的总长度是各成员长度之和.而在“联合”中,各成员共享一段内存空间,一个联合变量的长度 ...
- QT延时方法整理(QTimer::singleShot,QWaitCondition,QDateTime.secsTo三种新方法)
1: void QTimer::singleShot ( int msec, QObject * receiver, const char * member ) [static] 样例: #inclu ...
- linux下编译qt5.6.0静态库(使用./configure --help来看看都有哪些参数。超详细,有每一个模块的说明。如果改变了安装的目录,需要到安装目录下的bin目录下创建文件qt.conf)(乌合之众)good
linux下编译qt5.6.0静态库 linux下编译qt5.6.0静态库 configure生成makefile 安装选项 Configure选项 第三方库: 附加选项: QNX/Blackberr ...
- kafka设计原理(转)
一.kafka简介 1.1 背景历史 当今社会各种应用系统,诸如商业.社交.搜索.浏览等信息工厂一样不断被生产出各种信息,在大数据时代,我们面临如下几个挑战: 如何收集这些巨大的信息 如何分析它 如何 ...