小编Yot*_*jon的帖子

你能去掉 UIPickerView 中的不透明矩形吗?

我想删除 UIPickerView 中的这个灰色框。 在此输入图像描述

我正在尝试重新创建这个。 在此输入图像描述

如果有办法我将不胜感激。

这是代码片段。我对 UIKit 不太熟悉,但如果您发现有任何可以改进的地方,我也希望得到提示。我知道 SwiftUI 没有 UIKit 所具有的自定义功能,这就是我使用 UIKit 的原因。

var data = ["23","24","25","26","27","28","29"]

struct CustomPicker: UIViewRepresentable {
    @Binding var selected: String
    func makeCoordinator() -> Coordinator {
        return CustomPicker.Coordinator(parent1: self)
    }
    
    
    func makeUIView(context: UIViewRepresentableContext<CustomPicker>) -> UIPickerView {
        let picker = UIPickerView()
        
        picker.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
        picker.dataSource = context.coordinator
        picker.delegate = context.coordinator
        return picker
    }

    func updateUIView(_ uiView: UIPickerView, context: UIViewRepresentableContext<CustomPicker>) {
        
    }
    
    class Coordinator: NSObject, UIPickerViewDelegate, UIPickerViewDataSource {
        var parent: CustomPicker
        init(parent1: CustomPicker) {
            parent = parent1 …
Run Code Online (Sandbox Code Playgroud)

uipickerview uikit swiftui

4
推荐指数
1
解决办法
703
查看次数

如何将 BLE 设备中的十六进制数据分解为可用数据?(速度和节奏)

我正在构建一个仅显示速度和节奏的 iOS 应用程序。我已成功连接到 BLE 设备并接收数据。我根本不知道从这里该做什么。我如何理解这些数据?

这是收到的数据

central.state is .poweredOn
<CBPeripheral: 0x2838f48c0, identifier = A7DBA197-EF45-A8E5-17FB-DF8505493179, name = DuoTrap S, state = disconnected>
Peripheral(id: 0, name: "DuoTrap S", rssi: -70)
Connected!
<CBService: 0x281cbd380, isPrimary = YES, UUID = Cycling Speed and Cadence>
<CBCharacteristic: 0x282de4420, UUID = 2A5B, properties = 0x10, value = {length = 11, bytes = 0x03030000005d1601008212}, notifying = NO>
2A5B: properties contains .notify
<CBCharacteristic: 0x282df8660, UUID = 2A5C, properties = 0x2, value = {length = 2, bytes = 0x0700}, notifying …
Run Code Online (Sandbox Code Playgroud)

ios core-bluetooth bluetooth-lowenergy swift

2
推荐指数
1
解决办法
1427
查看次数