( iOS ) What is superview and what is subviews

ios, iphone, objective-c++, view, xcode

Solution

A superview is a view that holds other views over it and subviews are the views being held/added over a View.

Let's assume we have a view named MyView, which holds a UIButton (named loginButton) over it. Here MyView is considered a superview for loginButton and loginButton is considered a subview of MyView.

For more, you should start from here

As per the provided code snippet.

[self.view addSubview:self.frontView];

Hence view (Controller's view) is a superview and frontView is a subview

Problem

What is superview and what is subviews? When I add this code: ``` [self.view addSubview:self.frontView]; // what does that mean ? ``` And... ``` @property (nonatomic, strong) IBOutlet UIImageView *frontView; [self.frontView superview] != nil // means ? ``` what is in superview?

Original source