intelli78
intelli78

Reputation: 137

In Cocoa, what is the difference between a View and a Frame?

I have searched online and read through Apple docs, but I can't find a straightforward explanation of the difference between a View and a Frame, and how they relate to one another. I would appreciate an explanation, and please feel free to include any other related terms that will help clarify.

Upvotes: 2

Views: 65

Answers (1)

Rob
Rob

Reputation: 437592

A "view" is a visual element that appears in your app's UI. Most of the elements you see on screen (labels, buttons, etc.) are types of "views". See What Are Views.

In Cocoa, the frame is merely a property of a view that defines where the view is located (the origin, defined as the x and y coordinates that dictate where the view is placed within its superview) and how big it is (the size, defined as the width and height of the view). See Understanding a View's Frame and Bounds.

Upvotes: 10

Related Questions