简体   繁体   中英

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.

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM