iOS13 适配和Xcode11.0踩坑小结
2020年02月13日
作者:佚名
iOS13中presentViewController的问题
更新了Xcode11.0 beta之后,在iOS13中运行代码发现presentViewController和之前弹出的样式不一样。
私有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 适配和Xcode11.0踩坑小结全部内容,希望文章能够帮你解决iOS13 适配和Xcode11.0踩坑小结所遇到的程序开发问题。
如果觉得来客网网站内容还不错,欢迎将来客网网站推荐给程序员好友。