Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Simple iPhone App (iOS7) Understanding Views and View Controllers What Is a UIViewController?

Matthew Choy
Matthew Choy
4,928 Points

UIView equals to View?

as far as I know,

1.view= UIView + window 2.view does not equal to UIView

am i right?

and what does it mean by view disappearing and reappear,does it mean like a screen goes black and change to another scene?Thanks.

1 Answer

The 'View' on your app as in the elements are all instances of UIView. What that means is that it is a UIView.

// For example
@interface Animal : NSObject

@property ( strong, nonatomic ) NSString *name;
@property ( strong, nonatomic ) NSInteger *age;

@end

Now we have a class called Animal. We can now make a variable called 'dog' that is an instance of Animal. Like so:

Animal *dog = [ [ Animal alloc ] init ]; 

Now we get a variable called dog that is an instance of Animal. Much in the same way, the View in the Interface Builder is just another instance of the UIView class.

Now, the viewDidAppear method is called everytime the view (a single screen, a different screen of your app, or your entire app itself) appears in the foreground. As in, you open it from your home screen, or your recents page, or even changing screens within your app. In the same way, disappearing means when the screen is not in the foreground, and is in the background.

Hope this helps.