1.定位適配
如果希望在app在前臺后臺都可以使用定位服務,需要完成以下幾點:
1,在plist中增加NSLocationWhenInUseUsageDescription和 ? ? ? ? ? ? ? ? ? ? NSLocationAlwaysAndWhenInUsageDescription,如果需要支持iOS10的話,增加NSLocationAlwaysUsageDescription。
2,創(chuàng)建CLLocationManager對象,用requestWhenInUseAuthorization()獲得基本定位支持,用requestAlwaysAuthorization()獲得前后臺定位支持。
3,在第一次調用requestAlwaysAuthorization()時,會提示NSLocationAlwaysAndWhenInUsageDescription中指定的文字,讓用戶選擇是升級到全權限還是,前臺權限。
4,通過func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus)處理權限變化。該函數(shù)并不會在每次改改變權限后都會被調用。
2.tableView浮動適配
在appdelegate中添加如下代碼:
if (@available(iOS 11, *)) {
[UIScrollView appearance].contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; //iOS11 解決SafeArea的問題,同時能解決pop時上級頁面scrollView抖動的問題
}
3.參考鏈接
1. https://zhuanlan.zhihu.com/p/29778372? iOS11適配及iPhoneX適配
2.http://www.lxweimin.com/p/efbc8619d56b? iOS 11 安全區(qū)域適配總結
3.http://blog.csdn.net/qq_31810357/article/details/78047778 ?定位問題適配
4.http://blog.csdn.net/spicyShrimp/article/details/77891717 ? 導航按鈕適配