ios 自定义tabItem中的SF符号

dxpyg8gm  于 2022-12-05  发布在  iOS
关注(0)|答案(1)|浏览(145)

我正在使用SF符号为图像轮播创建点。我希望这些点是小的和白色的/轮廓。到目前为止,我已经能够减少点之间的间距。现在,所有的修改器对符号的大小没有影响。

TabView {
                ForEach(shop.photos?[..<3] ?? [], id:\.self) { url in
                    AsyncImage(
                        url: URL(string: url),
                        content: { image in
                            image.resizable()
                                .scaledToFill()
                                .frame(width: 250, height: 250, alignment: .center)
                                .clipped()
                        },
                        placeholder: {
                            ProgressView()
                        }
                    ).tabItem {
                        Image(systemName: "circle") // Also tried with Label("", systemImage: "circle")
                            .renderingMode(.original) // None of these modifiers had any impact
                            .resizable(resizingMode: .stretch)
                            .aspectRatio(contentMode: .fit)
                            .frame(width: 1.0, height: 1.0)
                            .font(.system(size: 100))
                    }
                }
            }.onAppear() {
                let appearance = UITabBarAppearance()

                appearance.stackedItemPositioning = .centered
                appearance.stackedItemWidth = 10

                UITabBar.appearance().standardAppearance = appearance
            }
oalqel3c

oalqel3c1#

您可以添加前景色以更改图标的颜色。

Image(systemName: "circle") // Also tried with Label("", systemImage: "circle")
                             .renderingMode(.original) // None of these modifiers had any impact
                             .resizable(resizingMode: .stretch)
                             .aspectRatio(contentMode: .fit)
                             .frame(width: 100.0, height: 100.0)
                             .font(.system(size: 100))
                             .foregroundColor(.white)

相关问题