点击PresentationLink(SwiftUI)时如何禁用Flash?

时间:2019-07-09 16:04:45

标签: ios xcode swiftui

点击按钮时如何禁用突出显示的颜色?

现在,当我点击它时,它会变成灰色并调用该动作,但是我想禁用它。 目前有可能吗?

CREATE TABLE #Table (ID int IDENTITY(1,1), xmlColumn xml);  

INSERT INTO #Table VALUES('  
<script>
    <string>00000</string>
    <dup></dup>
    <tabList>
        <tab>
            <id>first</id>
            <inData></inData>
            <inScript></inScript>
            <outData></outData>
            <outScript></outScript>
        </tab>
    </tabList>  
    <tabList>
        <tab>
            <id>second</id>
            <inData></inData>
            <inScript></inScript>
            <outData>Big house</outData>
            <outScript>Big shop</outScript>
        </tab>
    </tabList>
</script>'), ('  
<script>
    <string>00000</string>
    <dup></dup>
    <tabList>
        <tab>
            <id>first</id>
            <inData></inData>
            <inScript></inScript>
            <outData></outData>
            <outScript></outScript>
        </tab>
    </tabList>  
    <tabList>
        <tab>
            <id>second</id>
            <inData></inData>
            <inScript></inScript>
            <outData>Big house</outData>
            <outScript>Big shop</outScript>
        </tab>
    </tabList>
</script>')

1 个答案:

答案 0 :(得分:0)

PresentationView似乎没有一种样式的按钮,我怀疑它会永远存在。但是,还有其他方法可以呈现视图。下面有一个避免这种情况的示例。它有些冗长,但可以满足您的目的。

从beta3开始,模态似乎有一个错误,并且永远不会调用onDismiss方法。因此很难正确重置isPresented变量。同时,我为此使用了一种解决方法。检查以下答案是否正确: https://stackoverflow.com/a/56939555/7786555

struct ContentView : View {
    @State var isPresented = false

    var body: some View {

        VStack(spacing: 30) {
            // Option #1, with blink
            PresentationLink(destination: NextView(), label: {
                Text("Click to show")
            })

            // Option #2, without blink
            Text("Click to show").color(.blue).tapAction { self.isPresented = true }
                .presentation(isPresented ? Modal(NextView()) : nil)
        }

    }
}

struct NextView: View {
    var body: some View {
        Text("aloha!")
    }
}