Edward Anthony Edward Anthony - 1 month ago 6x
iOS Question

( iOS ) What is superview and what is subviews

What is superview and what is subviews?

When I add this code:

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


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

what is in superview?


superview means a view which holds the another view over it. subviews means the views which are holding/added over a 'View'.

Lets Say. you have a view MyView which has a UIButton(loginButton) over it.So, MyView is superview for that loginButton. loginButton is a subview forMyView`.

For more ,you should start from here