Skip to Content
Building Cocoa Applications: A Step by Step Guide
book

Building Cocoa Applications: A Step by Step Guide

by Simson Garfinkel, Michael Mahoney
May 2002
Intermediate to advanced
646 pages
18h 57m
English
O'Reilly Media, Inc.
Content preview from Building Cocoa Applications: A Step by Step Guide

A Closer Look at the NSView Class

NSView is one of Cocoa’s most complicated classes. If you understand how it works, you can control the display of information on the computer’s screen and have it updated quickly and efficiently.

NSView Coordinate Systems

Each Cocoa NSView has its own coordinate system that can be rotated, scaled, or otherwise transformed from the coordinate system of its superview.

Each NSView also has the following two methods that describe its position in its window:

- (NSRect)frame

Returns the NSView’s frame in the coordinate system of its superview

- (NSRect)bounds

Returns the NSView’s frame (i.e., bounds) in its own coordinate system

When you change an NSView’s coordinate system, its bounds instance variable is automatically updated to reflect the change, while its frame instance variable remains the same. The NSView class provides the following methods for inspecting and changing an NSView’s coordinate system:

- (float)boundsRotation

Returns a floating-point number for the angle, in degrees, between an NSView’s coordinate system and the coordinate system of its superview.

- (float)frameRotation

Returns the angle of the NSView’s frame relative to its superview’s coordinate system. A value of 0 means that the NSView has not been rotated (but its coordinate system may have been).

- (BOOL)isRotatedFromBase

Returns TRUE if an NSView or any of its ancestors have been rotated from the window coordinate system.

- (BOOL)isRotatedOrScaledFromBase

Returns TRUE ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Cocoa and Objective-C: Up and Running

Cocoa and Objective-C: Up and Running

Scott Stevenson
Learning Cocoa with Objective-C, 2nd Edition

Learning Cocoa with Objective-C, 2nd Edition

Apple Computer Inc, James Duncan Davidson
Learning Cocoa

Learning Cocoa

Jonathon Manning, Tim Nugent, Paris Buttfield-Addison

Publisher Resources

ISBN: 0596002351Catalog PageErrata