iOS13中presentViewController的问题
程序员文章站
2022-06-24 11:35:01
iOS13中presentViewController的问题 更新了Xcode11.0 beta之后,在iOS13中运行代码发现 和之前弹出的样式不一样。 会出现这种情况是主要是因为我们之前对 里面的一个属性,即 (该属性是控制器在模态视图时将要使用的样式)没有设置需要的类型。在iOS13中 的默认 ......
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];
文章若有不对地方,欢迎批评指正
推荐阅读
-
php中fopen不能创建中文文件名文件的问题详解
-
Chrome中模态对话框showModalDialog返回值问题的解决方法_javascript技巧
-
js全局变量在其他方法中赋值后无法影响到该方法外的全局变量的值(奇葩问题)
-
js中for循环内的匿名函数使用i的问题及解决方案
-
mysql中自增auto_increment功能的相关设置及问题
-
iOS中UITableview错位的问题怎么修复
-
在iOS10系统中微信后退无法发起ajax请求的问题解决办法
-
MySQL关于字符串中数字排序的问题分析
-
完美转换MySQL的字符集 解决查看utf8源文件中的乱码问题
-
iOS中关于UIWindow和statusbar的设置问题