April 2015
Intermediate to advanced
556 pages
17h 47m
English
Create a new single-window application with one window. As the user resizes the window, make sure that the window always remains twice as tall as it is wide.
Here is the signature of the delegate method you will implement:
optional func windowWillResize(sender: NSWindow,
toSize frameSize: NSSize) -> NSSize
The first argument is the window that is being resized. The second argument describes the size that the user has asked for. The return value is the size that the user will get.
Hint: The second argument and the return value are typealiases for a struct:
struct CGSize {
var width: CGFloat
var height: CGFloat
}
Here is how you create an appropriate NSSize to return that is 200 ...
Read now
Unlock full access