iOS13系统的一些适配问题

1、UIViewController切换方式modalPresentationStyle

iOS13默认UIModalPresentationAutomatic模式,需要改模式要用UIModalPresentationFullScreen。

vc.modalPresentationStyle = UIModalPresentationFullScreen;

但问题是项目里vc太多,viewController并没有一个相同父VC,全局改太费劲了。

所以:

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

//iOS 13 的 presentViewController 默认有视差效果,模态出来的界面现在默认都下滑返回。一些页面必须要点确认才能消失的,需要适配。如果项目中页面高度全部是屏幕尺寸,那么多出来的导航高度会出现问题。

@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"];

解决:

导入头文件:

#import <objc/runtime.h>
Ivar ivar =  class_getInstanceVariable([UITextField class], "_placeholderLabel");
UILabel *placeholderLabel = object_getIvar(textField, ivar);
placeholderLabel.textColor = [UIColor whiteColor];

3.  UITableViewCell的UITableViewCellAccessoryDisclosureIndicator 显示不正常

解决问题:  

cell.accessoryView = [[UIImageView alloc] initWithImage:[UIImage imageNamed: @"img_deviceInfo_arrow"]];

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值