gpt4 book ai didi

iphone - ( iOS ) 什么是 superview 什么是 subviews

转载 作者:可可西里 更新时间:2023-11-01 03:36:10 29 4
gpt4 key购买 nike

什么是父 View ,什么是 subview ?

当我添加这段代码时:

[self.view addSubview:self.frontView];
// what does that mean ?

还有……

@property (nonatomic, strong) IBOutlet UIImageView *frontView;
[self.frontView superview] != nil // means ?

superview 里有什么?

最佳答案

superview 是持有其他 View 的 View ,subviews 是持有/添加到View 的 View 。 p>

假设我们有一个名为 MyView 的 View ,它上面有一个 UIButton(名为 loginButton)。这里 MyView 被认为是 loginButtonsuperviewloginButton 被认为是 subview 我的 View

For more, you should start from here

根据提供的代码片段。

[self.view addSubview:self.frontView];

因此,view(Controller 的 View )是一个superview,而frontView 是一个subview

关于iphone - ( iOS ) 什么是 superview 什么是 subviews,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13123306/

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