我想使用 SegmentedPickerStyle() 在 Picker 中设置一些字体样式。但是任何字体格式都会被忽略。有没有办法为 segmentedPicker 设置字体?我很确定它适用于默认的pickerWheel ..
import UIKit
import PlaygroundSupport
import SwiftUI
// Make a SwiftUI view
struct ContentView: View {
@State private var selection: Int = 2
var body: some View {
Picker("", selection: self.$selection) {
Text("Shape").tag(0)
Text("Height").tag(1)
Text("Media").tag(2).font(.headline)
}
.font(.headline)
.cornerRadius(8)
.padding(10)
.pickerStyle(SegmentedPickerStyle())
}
}
// Make a UIHostingController
let viewController = UIHostingController(rootView: ContentView())
// Assign it to the playground's liveView
PlaygroundPage.current.liveView = viewController
// RUN!
Run Code Online (Sandbox Code Playgroud)
我将 AWS S3 存储与 Amplify 结合使用,为了避免多次上传同一文件,我想检查该文件是否已存在。
目前通过 Amplify 获取下载 url,但如果文件不存在,它也会生成一个 url。我希望它返回一个错误:
_ = Amplify.Storage.getURL(key: "myKey") { event in
switch event {
case let .success(url):
print("Completed: \(url)")
case let .failure(storageError):
print("Failed: \(storageError.errorDescription). \(storageError.recoverySuggestion)")
}
Run Code Online (Sandbox Code Playgroud)
}
还有其他方法可以检查文件是否存在于 amplify 中吗?
当然不用下载。重点是节省流量。
我的应用程序随机崩溃并出现此错误:
[ServicesDaemonManager] interruptionHandler is called.
-[FontServicesDaemonManager connection]_block_invoke
Run Code Online (Sandbox Code Playgroud)
(didReceiveMemoryWarning 在错误消息之前触发)
由于随机性,发布代码有点困难。我使用 SwiftUI (UIHostingController)、@ObserverObjects、异步网络调用、转换到其他视图等。
大多数时候一切正常,但有时我遇到了这个错误。然后内存不断增加,直到应用程序崩溃。
我试图修复所有可能的内存泄漏(释放所有图像,[弱自我],...)没有帮助。
我不确定 FontServicesDaemonManager 正在做什么以及它以何种方式参与,但所有字体都使用系统字体:
.font(Font.system(size: 25 , weight: .regular))
Run Code Online (Sandbox Code Playgroud)
有时此错误也会出现在上述错误之后:
-[UIWindow endDisablingInterfaceAutorotationAnimated:] called on <UIWindow: 0x10aab11a0; frame = (0 0; 375 812); gestureRecognizers = <NSArray: 0x10acb2510>; layer = <UIWindowLayer: 0x10aacbee0>> without matching -beginDisablingInterfaceAutorotation. Ignoring.
Run Code Online (Sandbox Code Playgroud)
任何人都遇到过类似的问题或知道如何解决这个问题?(Xcode 11.6)
LiDAR 的对象遮挡可在 RealityKit 中通过场景理解选项发挥作用。基本上,扫描的几何形状用于遮挡。
arView.environment.sceneUnderstanding.options.insert(.occlusion)
Run Code Online (Sandbox Code Playgroud)
遗憾的是,这没有包含在 SceneKit 中。虽然仍然可以通过 ARMeshAnchor 从 LiDAR 获取扫描的几何图形,但必须从该几何图形手动完成对象遮挡。这是对此的讨论:苹果论坛
这种方法已经有解决方案了吗?
升级到 iOS14 后,每当我向场景添加基本节点时,都会收到 Metal 警告。我不使用任何阴影,只使用标准材质。
2020-09-24 18:51:04.548764+0100 Arvie AR[383:7987] [Metal Compiler Warning] Warning: Compilation succeeded with:
program_source:95:26: warning: unused function 'reduce_op'
static inline float4 reduce_op(float4 d0, float4 d1)
^
program_source:581:26: warning: unused variable 'scn_shadow_sampler_ord_z'
static constexpr sampler scn_shadow_sampler_ord_z = sampler(coord::normalized, filter::linear, mip_filter::none, address::clamp_to_edge, compare_func::greater_equal);
^
Run Code Online (Sandbox Code Playgroud)
这是我添加的非常基本的节点:
let target = SCNTube(innerRadius: 0.0, outerRadius: 0.04, height: 0.003)
let basichAnchor = SCNNode(geometry: target)
basichAnchor.geometry?.firstMaterial?.diffuse.contents = UIColor.green
basichAnchor.castsShadow = false
Run Code Online (Sandbox Code Playgroud)
它仍然有效,但警告在 iOS13 中不存在。有人知道这究竟是什么意思吗?
swift ×4
arkit ×2
scenekit ×2
swiftui ×2
aws-amplify ×1
ios ×1
lidar ×1
metal ×1
realitykit ×1