That would be awesome by my standards. I have started the book but haven't really had time to start the challenges, if I had something to compare to maybe it would help me start working through them.
OK...so the challenge is titled "Make a delegate". Basically, it asks to build a single window application, that is constrained to it's width being twice the height.
I have seen more complicated answers, so I am not sure if this is even correct.
Created a class called Foo. Instantiated this in IB. Then connected *from* the window's delegate to Foo.
Then this code in Foo,m
Code:
- (NSSize)windowWillResize:(NSWindow *)window toSize:(NSSize)proposedFrameSize
{
NSSize newSize;
newSize.width = proposedFrameSize.height * 2.0;
newSize.height = proposedFrameSize.height;
NSLog(@"Current Size: Height %g: Width %g", newSize.height, newSize.width);
return newSize;
}
Initial size of the window was set in IB.
A few questions.
I saw one proposed solution that set the outlet of the Window to Foo programmatically. It seems to me, that **if** one can set it in the IB, this would be preferable? Hillegas earlier sets the oulet of speechSynthesizer to a class ( lets say Foo) programmatically, but I thought the reason for this was that that class could not be represented graphically in IB. So, my question is do "real programmers" do it this way.
It does work as expected.
Thanks