如何在CNContactViewController中访问子视图?

How would I access subviews in CNContactViewController?

提问人:daniel 提问时间:8/10/2023 更新时间:8/10/2023 访问量:24

问:

如何访问 CNContactViewController 中的子视图。我知道它们是CNContactViewController中UIView实例的属性,因为CNContactViewController继承自UIViewController。

这是我的代码:

print("subviews count: \(self.contactViewController.view.subviews.count)")

以下是调试窗口中的结果:

subviews count: 0
Swift UIVieviceController 联系人 CNConviceViewController

评论

0赞 HangarRash 8/10/2023
你什么时候调用这个代码?你是在联系人VC可见后调用它吗?为什么不使用 Xcode 的 View Hierarchy 调试器来查看布局呢?
0赞 Geoff Hackworth 8/10/2023
出于隐私原因,联系人视图控制器可能处于进程外,你的应用将无法看到其子视图。
0赞 daniel 8/13/2023
@GeoffHackworth好的。这是有道理的。

答: 暂无答案