iOS15适配笔记

一、导航的毛玻璃效果

在iOS15中,UINavigationBar默认是透明的,有滑动时会逐渐变为模糊效果,可以通过改变scrollEdgeAppearance属性直接变为模糊效果

 if (@available(iOS 15.0, *)){
        UINavigationBarAppearance *appearance = [[UINavigationBarAppearance alloc] init];
        appearance.backgroundEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleRegular];
        navBar.scrollEdgeAppearance = appearance;
    }

在iOS15中,UIImageWriteToSavedPhotosAlbum存储图片之后的回调不再返回图片了,会返回nil,如果在回调方法里面操作image有可能会直接Crash,目前的解决办法声明一个全局image去记录,后面再去操作

self.image = image;
UIImageWriteToSavedPhotosAlbum(image,self,@selector(image:didFinishSavingWithError:contextInfo:), NULL);
            
- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo{
	// self.image doing...
}

iOS 15 的 UITableView新增了一条新属性:sectionHeaderTopPadding, 默认会给每一个section header 增加一个高度,当我们使用 UITableViewStylePlain 初始化UITableView的时候,能发现sectionHeader增高了22px。解决办法就是手动去除这个高度

if (@available(iOS 15.0, *)) {
    tableView.sectionHeaderTopPadding = 0;
}

猜你喜欢

转载自blog.csdn.net/weixin_38201792/article/details/118344046