提交 ceaeba43 编写于 作者: DCloud_iOS_XHY's avatar DCloud_iOS_XHY

Update view.md

上级 ef060dde
......@@ -39,6 +39,17 @@ if(viewElement != null) {
}
```
**iOS 平台:**
获取view组件对应的UniElement对象,通过UniElement对象的[getAndroidView](../dom/unielement.html#getiosview)函数获取组件原生view对象
```uts
//通过 view 组件定义的 id 属性值,获取 view 标签的 UniElement 对象
const viewElement = uni.getElementById(id)
//获取原生 view
const view = viewElement?.getIOSView();
```
更多示例请参考 uts 插件 [uts-get-native-view](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/uni_modules/uts-get-native-view/utssdk/app-ios/index.uts)
<!-- UTSCOMJSON.view.children -->
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册