【无标题】App iOS端适配iOS 15系统

各位好:

App iOS端适配iOS 15系统,适配后将使用新的xcode 13打包提交App Store。

一、适配内容:

1、新增了iPhone 13 mini机型(尺寸同iPhone12 mini),5.4 英寸 (对角线) OLED 全面屏,屏幕分辨率为2340 x 1080 像素。如果是通过分辨率来判断则需要增加一个模式。

#define iPhone13mini ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(10802340), [[UIScreen mainScreen] currentMode].size) : NO)

2、使用xcode 13编译时,iOS 15 的UITableView新增了一个新属性:sectionHeaderTopPadding。

同时满足以下两个条件时,系统会给每一个section header增加22像素高度。

  1. 使用 UITableViewStylePlain 初始化 UITableView。
  2. 设置了_tableView.estimatedSectionHeaderHeight = xx;  或者  通过 - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section 函数返回sectionHead高度。

如果保持App整体UI不变,可以对UITableView进行全局设置。App会在DidFinishLauching函数中对sectionHeaderTopPadding进行全局设置。

if (@available(iOS 15.0, *)) {

    [UITableView appearance].sectionHeaderTopPadding = 0.0;

}

如果全局设置不满足UI风格,还可以通过如下代码自定义设置。自定义设置会覆盖全局设置。

if (@available(iOS 15.0, *)) {

    _tableView.sectionHeaderTopPadding = 0;

}

3、系统导航栏颜色等属性设置适配,xcode13编译,如果App使用系统导航栏,则需要使用新的方式设置系统导航栏。

if (@available(iOS 13.0, *)) {

    UINavigationBarAppearance *naviBarAppearance = [UINavigationBarAppearance new];

    naviBarAppearance.backgroundColor = [UIColor redColor];

    self.navigationBar.standardAppearance = naviBarAppearance;

    self.navigationBar.scrollEdgeAppearance = naviBarAppearance;

}else {

    self.navigationBar.backgroundColor = [UIColor redColor];

}

同样的适配也适用于UINavigationBar、UIToolbar 和 UITabBar 设置外观,都需要使用 UIBarAppearance APIs。

4、UIButton移除了font属性。如果有UI控件集成了UIButton并重新了setFont方法,在设置_font = font的地方代码会编译错误。需要移除setFont,给titleLabel设置font。

// 移除setFont方法,使用titleLabel.font代替。

- (void)setFont:(UIFont *)font

{

    _font = font;

}

在iOS 15系统上,UIButton新增了configuration属性。通过设置UIButtonConfiguration相关属性来描述UIButton的外观,比如 背景颜色、圆角、背景图片、文本、属性文本等。 原有的UIButton属性依然能用。

if (@available(iOS 15.0, *)) {

    UIButtonConfiguration *configration = [UIButtonConfiguration plainButtonConfiguration];

    configration.titlePadding = 10.0;

    configration.title = @"button主标题";

    configration.subtitle = @"button副标题";

    btn.configuration = configration;

}

5、推送通知功能适配(供推送业务参考)

App可以在iOS 15系统上通过对推送功能适配以控制通知的提醒方式。 iOS15的推送消息体中新增了 "interruption-level" ,控制通知到达时手机是否亮屏、播放声音等。relevance-score和通知排序有关。范围是0-1,分数越高,相关性越高。 具体可以进行实际验证。 适配时合理设置推送通知的消息级别,将重要消息及时精准的推送给用户,提供更好的使用体验。

6、Xcode13.0及以上版本编译出的App在iOS 15.0及以上系统上被限制了URL Scheme query的数量为50。对于plist中LSApplicationQueriesSchemes配置的scheme数量超过50的App,可能会导致不能唤起。

经验证,使用Xcode 13编译出的App,在iOS 15系统上,LSApplicationQueriesSchemes的数量会限制为50个。

第50个之后的scheme配置会不生效,canOpenURL 代码会返回NO。

关于OpenSDK iOS 15系统的适配说明 | 微信开放社区

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值