iOS13踩坑记录

 

1、UIViewController切换方式modalPresentationStyle

iOS13默认UIModalPresentationAutomatic模式,不符合我们的需求。改回之前的模式要用UIModalPresentationFullScreen。

vc.modalPresentationStyle = UIModalPresentationFullScreen;

但是,问题来了,项目里vc太多,而且因为接入了多家SDK,viewController并没有一个相同父VC,全局改太费劲了。

解决方案:

在appDelegate中实现了ViewController的分类,改变了modalPresentationStyle的值完美解决。

@implementation UIViewController(modalPresentationStyle)

- (UIModalPresentationStyle)modalPresentationStyle{

    return UIModalPresentationFullScreen;

}

@end

 2、"NSGenericException" - reason: "Access to UITextField's _placeholderLabel ivar is prohibited. This is an application bug"

设置TextFiled的默认文字颜色在iOS13 Crash。

[textfield setValue:[UIColor whiteColor] forKeyPath:@"_placeholderLabel.textColor"];

 查了一下,帖子挺多的,解决方案:

Ivar ivar =  class_getInstanceVariable([UITextField class], "_placeholderLabel");
UILabel *placeholderLabel = object_getIvar(textField, ivar);
placeholderLabel.textColor = [UIColor whiteColor];

记得加头文件

#import <objc/runtime.h>

 未完待续。。

  • 4
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 7
    评论
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值