如何在MacOS上使SwiftUI的Picker无边界/透明?

时间:2019-10-25 23:45:49

标签: swift macos swiftui appkit

我想在macOS的SwiftUI中将选择器按钮设置为无边界且透明。

我尝试在Picker视图上使用.background().border().opacity()修饰符。但是,我无法使用.background()将背景更改为透明颜色,无法使用.border()移除边框,也无法找到一种方法使用.opacity()仅将背景更改为透明Picker(selection: .constant(1), label: EmptyView()) { Text("1").tag(1) Text("2").tag(2) } .scaledToFit()

这是我给选择器的代码:

.constant(1)

Picker是一个占位符

当前选择器如下所示:
Current Picker Look

我希望它看起来像Mac上“通讯录”应用中的选择器:
Wanted Picker Look


更新(2019-11-30)

尝试了所有可能适用于Traceback (most recent call last): File "/Users/HectorVelasquez/PycharmProjects/Project 1/Project 1 python.py", line 57, in <module> df['log'] = df['Latitude'].apply(lambda x: convert_rad(x)) File "/Users/HectorVelasquez/PycharmProjects/Project 1/venv/lib/python3.7/site-packages/pandas/core/series.py", line 4045, in apply mapped = lib.map_infer(values, f, convert=convert_dtype) File "pandas/_libs/lib.pyx", line 2228, in pandas._libs.lib.map_infer File "/Users/HectorVelasquez/PycharmProjects/Project 1/Project 1 python.py", line 57, in <lambda> df['log'] = df['Latitude'].apply(lambda x: convert_rad(x)) File "/Users/HectorVelasquez/PycharmProjects/Project 1/Project 1 python.py", line 7, in convert_rad degree = int(temp[0]) + int(temp[1][:-1])/60 ValueError: invalid literal for int() with base 10: '81?36N' 的修饰符和函数后,我确定到目前为止没有解决方案。截至目前,SwiftUI尚未完全替代情节提要或XIB。

0 个答案:

没有答案