小编Ahm*_*raz的帖子

如何在 SwiftUI tvOS 中检测“点击”手势

使用:

  • 用户界面
  • 斯威夫特 5
  • 操作系统
  • Xcode 版本 11.2.1

我只想检测下面 URLImage 上的点击手势

JFYI我对 Xcode、Swift 和 SwiftUI 非常陌生(不到 3 周)。

URLImage(URL(string: channel.thumbnail)!,
                 delay: 0.25,
                 processors: [ Resize(size: CGSize(width:isFocused ?  300.0 : 225.0, height:isFocused ?  300.0 : 225.0), scale: UIScreen.main.scale) ],
                 content:  {
                    $0.image
                        .resizable()
                        .aspectRatio(contentMode: .fill)
                        .clipped()
        })
            .frame(width: isFocused ?  300.0 : 250.0, height:isFocused ?  300.0 : 250.0)
            .clipShape(Circle())
            .overlay(
                Circle().stroke( isFocused ? Color.white : Color.black, lineWidth: 8))
            .shadow(radius:5)
            .focusable(true, onFocusChange:{ (isFocused) in
                withAnimation(.easeInOut(duration:0.3)){
                    self.isFocused = isFocused
                }
                if(isFocused){
                    self.manager.bannerChannel …
Run Code Online (Sandbox Code Playgroud)

swift tvos swiftui

7
推荐指数
2
解决办法
2213
查看次数

标签 统计

swift ×1

swiftui ×1

tvos ×1