We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UINavigationBar
在iOS15中,UINavigationBar默认是透明的,有滑动时会逐渐变为模糊效果,可以通过改变UINavigationBar.scrollEdgeAppearance属性直接变为模糊效果、配置相关属性-背景、字体等
UINavigationBar.scrollEdgeAppearance
if #available(iOS 15, *) { let app = UINavigationBarAppearance.init() app.configureWithOpaqueBackground() // 重置背景和阴影颜色 app.titleTextAttributes = [ NSAttributedString.Key.font: UIFont.systemFont(ofSize: 18), NSAttributedString.Key.foregroundColor: UIColor.white ] app.backgroundColor = UIColor.theme // 设置导航栏背景色 app.shadowImage = UIColor.clear.image // 设置导航栏下边界分割线透明 navigationBar.scrollEdgeAppearance = app // 带scroll滑动的页面 navigationBar.standardAppearance = app // 常规页面 }else{ //version<=15.0//15.0 之前的写法 }
从 iOS 15 开始,TableView 增加sectionHeaderTopPadding属性,默认情况sectionHeaderTopPadding会有22个像素的高度,及默认情况,TableView section header增加22像素的高度
if #available(iOS 15.0, *) { self.tableView.sectionHeaderTopPadding = 0 }
在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... }
tabbar的问题和navigationBar的问题属于同一类,tabbar背景颜色设置失效,字体设置失效,阴影设置失效问题
if #available(iOS 15, *) { let bar = UITabBarAppearance.init() bar.backgroundColor = UIColor.white bar.shadowImage = UIColor.init(0xEEEEEE).image let selTitleAttr = [ NSAttributedString.Key.font: itemFont, NSAttributedString.Key.foregroundColor: UIColor.theme ] bar.stackedLayoutAppearance.selected.titleTextAttributes = selTitleAttr // 设置选中attributes self.tabBar.scrollEdgeAppearance = bar self.tabBar.standardAppearance = bar }
if let presentationController = presentationController as? UISheetPresentationController { // 显示时支持的尺寸 presentationController.detents = [.medium(), .large()] // 显示一个指示器表示可以拖拽调整大小 presentationController.prefersGrabberVisible = true }
// Plain let plain = UIButton(configuration: .plain(), primaryAction: nil) plain.setTitle("Plain", for: .normal) // Gray let gray = UIButton(configuration: .gray(), primaryAction: nil) gray.setTitle("Gray", for: .normal) // Tinted let tinted = UIButton(configuration: .tinted(), primaryAction: nil) tinted.setTitle("Tinted", for: .normal) // Filled let filled = UIButton(configuration: .filled(), primaryAction: nil) filled.setTitle("Filled", for: .normal)
let locationButton = CLLocationButton() // 文字 locationButton.label = .currentLocation locationButton.fontSize = 20 // 图标 locationButton.icon = .arrowFilled // 圆角 locationButton.cornerRadius = 10 // tint locationButton.tintColor = UIColor.systemPink // 背景色 locationButton.backgroundColor = UIColor.systemGreen // 点击事件,应该在在其中发起定位请求 locationButton.addTarget(self, action: #selector(getCurrentLocation), for: .touchUpInside)
// 加载数据 let (data, response) = try await URLSession.shared.data(from: url) // 下载 let (localURL, _) = try await session.download(from: url) // 上传 let (_, response) = try await session.upload(for: request, from: data)
// hierarchicalColor:多层渲染,透明度不同 let config = UIImage.SymbolConfiguration(hierarchicalColor: .systemRed) let image = UIImage(systemName: "square.stack.3d.down.right.fill", withConfiguration: config) // paletteColors:多层渲染,设置不同风格 let config2 = UIImage.SymbolConfiguration(paletteColors: [.systemRed, .systemGreen, .systemBlue]) let image2 = UIImage(systemName: "person.3.sequence.fill", withConfiguration: config2)
// preparingThumbnail UIImage(named: "sv.png")?.preparingThumbnail(of: CGSize(width: 200, height: 100)) // prepareThumbnail,闭包中直接获取调整后的UIImage UIImage(named: "sv.png")?.prepareThumbnail(of: CGSize(width: 200, height: 100)) { image in // 需要回到主线程更新UI } // byPreparingThumbnail await UIImage(named: "sv.png")?.byPreparingThumbnail(ofSize: CGSize(width: 100, height: 100))
The text was updated successfully, but these errors were encountered:
miss-shiyi
No branches or pull requests
1. 导航栏
UINavigationBar
在iOS15中,
UINavigationBar
默认是透明的,有滑动时会逐渐变为模糊效果,可以通过改变UINavigationBar.scrollEdgeAppearance
属性直接变为模糊效果、配置相关属性-背景、字体等2. TableView
从 iOS 15 开始,TableView 增加sectionHeaderTopPadding属性,默认情况sectionHeaderTopPadding会有22个像素的高度,及默认情况,TableView section header增加22像素的高度
3. UIImageWriteToSavedPhotosAlbum存储图片不在返回图片
在iOS15中,UIImageWriteToSavedPhotosAlbum存储图片之后的回调不再返回图片了,会返回nil,如果在回调方法里面操作image有可能会直接Crash,目前的解决办法声明一个全局image去记录,后面再去操作
4. UITabbar
5. 对状态编程的支持:UICellConfigurationState;UICollectionViewCell、UITableViewCell都支持状态变化时的block执行了。
6. UICollectionViewLayout支持自动高度;AutomaticDimension
7. json解析支持json5了
8. 增加UISheetPresentationController,通过它可以控制 Modal 出来的 UIViewController 的显示大小,且可以通过拖拽手势在不同大小之间进行切换。只需要在跳转的目标 UIViewController 做如下处理
9. UIButton支持更多配置。UIButton.Configuration是一个新的结构体,它指定按钮及其内容的外观和行为。它有许多与按钮外观和内容相关的属性,如cornerStyle、baseForegroundColor、baseBackgroundColor、buttonSize、title、image、subtitle、titlePadding、imagePadding、contentInsets、imagePlacement等。
10. 推出CLLocationButton用于一次性定位授权,该内容内置于CoreLocationUI模块,但如果需要获取定位的详细信息仍然需要借助于CoreLocation。
11.URLSession 推出支持 async/await 的 API,包括获取数据、上传与下载。
12.系统图片支持多个层,支持多种渲染模式。
13. UIImage 新增了几个调整尺寸的方法。
The text was updated successfully, but these errors were encountered: