ios13中presentviewcontroller的问题
更新了xcode11.0 beta之后,在ios13中运行代码发现presentviewcontroller和之前弹出的样式不一样。
会出现这种情况是主要是因为我们之前对uiviewcontroller里面的一个属性,即modalpresentationstyle(该属性是控制器在模态视图时将要使用的样式)没有设置需要的类型。在ios13中modalpresentationstyle的默认改为uimodalpresentationautomatic,而在之前默认是uimodalpresentationfullscreen。
|
1
2
3
4
5
6
|
/*
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即可。
|
1
2
3
4
5
|
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的方法:
|
1
2
|
[_textfield setvalue:[uicolor redcolor] forkeypath:@"_placeholderlabel.textcolor"];
[_textfield setvalue:[uifont systemfontofsize:14] forkeypath:@"_placeholderlabel.font"];
|
可以将其替换为
|
1
|
_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中的一些名称有影响,可能还会有其他影响有待关注。
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持快网idc。
相关文章
- ASP.NET本地开发时常见的配置错误及解决方法? 2025-06-10
- ASP.NET自助建站系统的数据库备份与恢复操作指南 2025-06-10
- 个人网站服务器域名解析设置指南:从购买到绑定全流程 2025-06-10
- 个人网站搭建:如何挑选具有弹性扩展能力的服务器? 2025-06-10
- 个人服务器网站搭建:如何选择适合自己的建站程序或框架? 2025-06-10
- 2025-07-10 怎样使用阿里云的安全工具进行服务器漏洞扫描和修复?
- 2025-07-10 怎样使用命令行工具优化Linux云服务器的Ping性能?
- 2025-07-10 怎样使用Xshell连接华为云服务器,实现高效远程管理?
- 2025-07-10 怎样利用云服务器D盘搭建稳定、高效的网站托管环境?
- 2025-07-10 怎样使用阿里云的安全组功能来增强服务器防火墙的安全性?
快网idc优惠网
QQ交流群
-
在ASP.NET 2.0中操作数据之三十一:使用DataList来一行显示多条记录
2025-05-29 77 -
springboot 高版本后继续使用log4j的完美解决方法
2025-05-27 40 -
2025-06-04 54
-
2025-06-04 88
-
2025-05-29 13




