前言
本著蘋果爸爸系統(tǒng)更新的一貫作風(fēng)(UI必亂)重绷,我開始了iOS15的探索仍稀;
基于Xcode Version 13.0 beta (13A5155e) iOS 15 beta2
NavigationBar顏色失效
self.navigationController.navigationBar.barTintColor = [[RSLColorDarMode sharedInstance] colorProviderWithLightColor:[UIColor whiteColor] withDarColor:UIColorFromRGB(0x202020)];
多么正常的代碼减拭,多么符合常理的操作件豌,但是在iOS15的頁面失效,不起作用皱炉;
無奈查找無果培漏,便前去蘋果論壇尋找答案溪厘,果然功夫不負(fù)有心人讓我找到了。
As of iOS 15, UINavigationBar, UIToolbar, and UITabBar will use their scrollEdgeAppearance when your view controller's associated scroll view is at the appropriate edge (or always if you don't have a UIScrollView in your hierarchy, more on that below).
從 iOS 15 開始牌柄,UINavigationBar畸悬、UIToolbar 和 UITabBar 將在您的視圖控制器的關(guān)聯(lián)滾動視圖位于適當(dāng)?shù)倪吘墪r(shí)使用它們的 scrollEdgeAppearance(或者總是如果您的層次結(jié)構(gòu)中沒有 UIScrollView,更多內(nèi)容見下文)珊佣。
You must adopt the UIBarAppearance APIs (available since iOS 13, specializations for each bar type) to customize this behavior. UIToolbar and UITabBar add scrollEdgeAppearance properties for this purpose in iOS 15.
您必須采用 UIBarAppearance API(自 iOS 13 起可用蹋宦,針對每種條形類型進(jìn)行了專門化)來自定義此行為。 UIToolbar 和 UITabBar 為此在 iOS 15 中添加了 scrollEdgeAppearance 屬性咒锻。
so冷冗,代碼更改如下:
if (@available(iOS 15.0, *)) {
UINavigationBarAppearance *navigationBarAppearance = [UINavigationBarAppearance new];
navigationBarAppearance.backgroundColor = [[RSLColorDarMode sharedInstance] colorProviderWithLightColor:[UIColor whiteColor] withDarColor:UIColorFromRGB(0x202020)];
self.navigationController.navigationBar.scrollEdgeAppearance = navigationBarAppearance;
self.navigationController.navigationBar.standardAppearance = navigationBarAppearance;
}
UITableView section增加默認(rèn)高度
/// Padding above each section header. The default value is `UITableViewAutomaticDimension`.
@property (nonatomic) CGFloat sectionHeaderTopPadding API_AVAILABLE(ios(15.0), tvos(15.0), watchos(8.0));
UITableView又新增了一個(gè)新屬性:sectionHeaderTopPadding 會給每一個(gè)section header 增加一個(gè)默認(rèn)高度,當(dāng)我們使用UITableViewStylePlain 初始化tableView的時(shí)候惑艇,就會發(fā)現(xiàn)系統(tǒng)默認(rèn)給section header增高了22像素蒿辙。
so, 代碼更改如下:
if (@available(iOS 15.0, *)) {
_tableView.sectionHeaderTopPadding = 0;
}
最好改在基類,一次解決所有問題滨巴;
目前發(fā)現(xiàn)的就是這兩個(gè)問題思灌,至于蘋果爸爸后續(xù)會不會修復(fù)那鬼知道哦~
后續(xù)有新的會繼續(xù)發(fā)出來,也歡迎大佬們留言討論蘋果爸爸的新坑~