假设我们有一个固定的侧边栏,如下所示:
.sidebar {
position: fixed;
top: 0;
left: 0;
min-width: 17em;
height: 100%;
}
Run Code Online (Sandbox Code Playgroud)
当 Safari 底部栏可见时,这是可以的,但是当向下滚动时,它会消失,侧边栏会在原来的位置保留一段时间,然后跳转到填充下面的空间。它看起来很麻烦。
height我尝试用以下解决方案之一进行替换,但没有一个起作用:
height: 100vh; // Sidebar is under the bottom bar
height: -webkit-fill-available; // Sidebar doesn't adjust its height
height: var(--window-inner-height); // CSS prop set via JS window.innerHeight. Same above
bottom: 0;
Run Code Online (Sandbox Code Playgroud)
有什么想法可以解决吗?
我看过一些关于iOS 15新Self._printChanges()功能的文章或视频,但在任何地方都找不到任何相关文档。有谁知道苹果在哪里记录了这个新功能?如何使用它是非常明显的,但我想看看我们可以用它做更多的事情,了解更多关于它的信息将会有所帮助。即使 Xcode 的查找也没有产生任何结果。有人发现什么吗?
我有几个与同一域关联的应用程序。它们以特定顺序列在 apple-app-site-association 文件中,以确保每个通用链接都由设备上安装的最合适的应用程序打开。这在 iOS 14 及更早版本的设备上运行良好。在 iOS 15 上,不再遵守该顺序,链接不是由第一个应用程序打开,而是由最后一个与链接路径匹配的应用程序打开。
这是我的 apple-app-site-association 文件:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "AAAAA.com.mydomain.BurritoApp",
"paths": [ "/burritos/*" ]
},
{
"appID": "AAAAA.com.mydomain.FoodApp",
"paths": [ "/burritos/*", "/tacos/*", "/deli/*" ]
},
{
"appID": "AAAAA.com.mydomain.OrderAnythingApp",
"paths": [ "/*" ]
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
在 iOS 14 上,BurritoApp 按预期处理墨西哥卷饼链接。
当我在装有 iOS 15 的设备上安装所有 3 个应用程序并点击墨西哥卷饼链接时,OrderAnythingApp 会处理该链接。如果我从上面的关联文件中删除 OrderAnythingApp 部分,那么 FoodApp 就会开始处理墨西哥卷饼链接。
我搜索了文档,观看了 2020 年和 2019 年与通用链接相关的 WWDC 视频,我尝试使用带有组件而不是路径的新关联文件格式。我仍然不知道是什么原因导致此问题以及如何解决它。
我使用 SwiftUI 3.0、Swift 5.5 和 Xcode 13.2,在 iOS 15.3 iPhone 设备和 iOS 15.2 iPhone 模拟器上进行了测试。
我已经测试了以下内容。
这是一个视图,带有一个 TextField、一个焦点状态和一个.toolbar
import SwiftUI
struct test: View {
@State private var name = "Taylor Swift"
@FocusState var isInputActive: Bool
var body: some View {
TextField("Enter your name", text: $name)
.textFieldStyle(.roundedBorder)
.focused($isInputActive)
.toolbar {
ToolbarItemGroup(placement: .keyboard) {
Spacer()
Button(name) {
isInputActive = false
}
}
}
}
}
struct test_Previews: PreviewProvider {
static var previews: some View {
test()
}
}
Run Code Online (Sandbox Code Playgroud)
它按预期完美工作,并且显示一个按钮,其中包含在 TextField 中键入的任何文本。 …
iOS 15 引入了“.refreshable”视图修饰符,但我见过的大多数示例都使用List. 我想在一个不使用列表而仅VStack使用Text如下视图的应用程序中实现拉动刷新功能。我该如何实现这一点,以便下拉刷新将刷新我的数据?
import SwiftUI
struct ContentView: View {
@State var songName = "Song"
@State var artistName = "Artist"
var body: some View {
VStack {
Text(songName)
Text(artistName)
}
.refreshable {
reloadData()
}
}
private func reloadData() {
songName = "Let it Be"
artistName = "The Beatles"
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Run Code Online (Sandbox Code Playgroud) iOS 15之前我做了之后
self.tableView.beginUpdates()
self.tableView.endUpdates()
Run Code Online (Sandbox Code Playgroud)
调用了 heightForRowAtindexPath 方法,并且我的单元格高度发生了变化,而无需在单元格中重新加载数据。现在在 iOS 15 中这不起作用!如何强制重新加载表格视图单元格高度而不重新加载此单元格中的数据?
我将 SwiftUI EditButton() 与 List() 一起使用,但它突然停止与 iOS15 一起使用。虽然我不使用包装式 NavigationView,但是它以前工作得很好。无论如何,使用 NavigationView 对我来说不是一个选择。
\nstruct Test: View {\n @State private var items: [String] = ["Item1", "Item2", "Item3"] // mock / demo\n \n var body: some View {\n VTile(padding: 0) {\n HStack {\n Text("Title")\n Spacer()\n }\n .overlay(EditButton())\n \n List {\n ForEach(items, id: \\.self) { item in\n HStack {\n Text(item)\n Spacer()\n }\n }\n .onDelete(perform: delete)\n .onMove(perform: move)\n }\n .listStyle(PlainListStyle())\n }\n }\n \n func move(from source: IndexSet, to destination: Int) {\n // ...\n }\n \n …Run Code Online (Sandbox Code Playgroud) 当我将 iPhone 上的 iOS 更新到版本 15 时,我遇到了问题。我发现当我向下滚动页面时,Safari 会隐藏导航栏。没关系,但是当我打开模式时就会出现问题。
当我使用以下众所周知的样式打开模态时
.modal {
position: absolute; /* or fixed */
top: 0;
right: 0;
bottom: 0;
left: 0;
/* following is what I tried to, but not work */
width: 100vw;
height: 100vh;
}
Run Code Online (Sandbox Code Playgroud)
和
<body>
...
<div class="modal">...</div>
</body>
Run Code Online (Sandbox Code Playgroud)
,底部导航栏区域已被清空,并填充了iOS15中应用的Website Tinting颜色。为了重现这个问题,
我附上它的图像以及与此问题相关的问题链接。
https://lzomedia.com/blog/modal-wont-resize-when-ios-15-safaris-navbar-expands/
我在我的应用程序SS中添加了位置背景模式
但该应用程序仍然无法使用启动选项键启动
UIApplication.LaunchOptionsKey.location
这是我的应用程序委托代码,
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
addItem(name: "LaunchOptions: \(String(describing: launchOptions))")
if let launchOptions = launchOptions {
if launchOptions[UIApplication.LaunchOptionsKey.location] != nil {
startLocationMonitoring()
}
}
print("LaunchOptions: \(String(describing: launchOptions))")
return true
}
func startLocationMonitoring() {
locationManager?.delegate = nil
locationManager = nil
locationManager = CLLocationManager()
locationManager?.delegate = self
locationManager?.desiredAccuracy = kCLLocationAccuracyBestForNavigation
locationManager?.distanceFilter = 1.0 // meters
locationManager?.allowsBackgroundLocationUpdates = true
locationManager?.activityType = .otherNavigation
locationManager?.pausesLocationUpdatesAutomatically = false …Run Code Online (Sandbox Code Playgroud) 首先,重要的是要知道OSLogStore 在 iOS 中不起作用就在 4 个月前,由于那是最近的事,而且文档又非常稀少,一年前可能正确的内容今天可能并不正确。
\n这是我的问题的一些背景(几乎是从这个 reddit 帖子中盗来的):
\n\n\n我开发的开源应用程序大约有 1000 个用户,用户时不时会报告一些奇怪的行为。
\n该应用程序使用[记录器 ] 来记录重要事件...是否可以使用远程日志记录服务,以便我可以获取此信息并为用户解决问题?
\n
我只关心是否有统一的日志系统是否有解决这个问题的方法。假设我能够与具有“奇怪行为”的用户交谈,并且他们不是技术人员。
\n我得到了一些提示,表明 OSLogStore 可能是一种获取远程日志的方法,但官方文档太少了,我无法判断。具体来说,init(url:)看起来很有趣,但也许它只接受file://协议或其他东西。
日志记录文档说它可以用于“当您无法将调试器附加到应用程序时,例如当您\xe2\x80\x99在用户\xe2\x80\x99s机器上诊断问题时”,但没有任何地方说这个怎么做。
\n