gpt4 book ai didi

ipad - 在中心添加 subview - iPad

转载 作者:行者123 更新时间:2023-12-03 18:20:58 25 4
gpt4 key购买 nike

我想在当前 View 中添加一个 subview ,这个 subview 是 300x300。当我使用添加 subview 时

[self.view addSubview:md.view];

md.view 将出现在位置 (0,0) 有没有办法在中心添加 subview ?

谢谢

最佳答案

您可以设置 View 的 center属性(property):

md.view.center = self.view.center;

或者您可以为 md.view 显式设置框架,以便它可以根据需要居中。

关于ipad - 在中心添加 subview - iPad,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2996408/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com