Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
568 views
in Technique[技术] by (71.8m points)

ios - How to get rendered view for some json blob

I have a need to render a ColumnSet as a UICollectionView rather than the default UIStackView. I couldn't find a clean way to do this by making a custom ColumnSet renderer so instead I've created a custom element type but, so as not to reinvent the wheel, I want to use Column elements to populate the cells of the UICollectionView. Like so:

        {
            "type": "Carousel",
            "items": [
                {
                    "type": "Column",
                    "items": [
                        {
                            "type": "TextBlock",
                            "size": "Large",
                            "weight": "Bolder",
                            "text": "Text 1"
                        }
                    ],
                    "width": "stretch"
                },
                {
                    "type": "Column",
                    "items": [
                        {
                            "type": "TextBlock",
                            "size": "Large",
                            "weight": "Bolder",
                            "text": "Text 2"
                        }
                    ],
                    "width": "stretch"
                }
            ]
        }

Now, all I need is the vertical stack view that AdaptiveCards would render for each of those columns. But I can't figure out how to get the rendered view. If I send a column json to ACOAdaptiveCard.fromJson() then I get an invalid parse result with error 3.

So the question boils down to, for any given json blob, how can I get the view that AC would have rendered in its normal render tree?

In other words, how to convert this:

    {
        "type": "Column",
        "items": [
            {
                "type": "TextBlock",
                "size": "Large",
                "weight": "Bolder",
                "text": "Text 2"
            }
        ],
        "width": "stretch"
    }

to a single UIStackView?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...