iOS 适配iOS11、iPhone X

来源:互联网 发布:淘宝有哪些部门 编辑:程序博客网 时间:2024/05/16 11:38

关于iPhone X尺寸及safe area

参考:

http://www.ui.cn/detail/283956.html

iPhone X 导航上和tabBar下两处空白(黑条)

解决方案:导入一张iPhone X要用的启动图(尺寸 1125*2436 )。


tableView 区头或区尾多出一部分

解决方案:加上之前省略的下面两个方法

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{    return nil;}- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{    return nil;}

tableView或其他滚动视图下移64像素

解决方案:

// AppDelegate 进行全局设置    if (@available(iOS 11.0, *)){        [[UIScrollView appearance] setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever];}

if (@available(iOS 11.0, *)) {        self.tableView.contentInset = UIEdgeInsetsMake(-64.,0,0,0);    } else {        self.automaticallyAdjustsScrollViewInsets = NO;    }


MjRefresh 的问题

解决方案:升级MjRefresh到3.1.14以上版本即可

pod 'MJRefresh’,'~> 3.1.14’

WKWebView 代理方法崩溃

解决方案:

WebViewJavascriptBridgeBase *base = [[WebViewJavascriptBridgeBase alloc] init];    if ([base isWebViewJavascriptBridgeURL:navigationAction.request.URL]) {        return;    }  // Add this IF statement in my project,  don`t need modify WebViewJavascriptBridge`s source code.    decisionHandler(WKNavigationActionPolicyAllow);

参考:点击打开链接

iOS 11下保存图片闪退

原因:

iOS 11之前只需有NSPhotoLibraryUsageDescription这一个授权即可读写相册内容。

iOS 11后需要对写入图片加入

NSPhotoLibraryAddUsageDescription进行授权。

解决方案:

在info.plist里添加对向相册写入数据的授权

<key>NSPhotoLibraryAddUsageDescription</key><string>需要您的同意才能保存到媒体资料库</string>

其他授权参考这里







原创粉丝点击