Sometimes I want to change NSView settings programmatically. To do this, it is useful to get the sizes of the different views, adjust them relative to each other, and then use setFrame: move.
The problem is that the frame method usually returns NSRects that are clearly wrong from my point of view.
I have a program with NSPanel configured in Interface Builder, and various connections to my main program. To check the NSRects returned by the frame, I opened a panel in my awakeFromNib application: a method, extracted some NSRects, and printed them on the console.
Here is my awakeFromNib:
- (void)awakeFromNib {
NSLog(@"in awakeFromNib");
[self showPrefsSheet:self];
originalFrame = [aTextView frame];
NSLog(@"the frame is %d, %d, %d, %d", originalFrame.origin.x, originalFrame.origin.y, originalFrame.size.width, originalFrame.size.height);
originalFrame = [aButton frame];
NSLog(@"the frame is %d, %d, %d, %d", originalFrame.origin.x, originalFrame.origin.y, originalFrame.size.width, originalFrame.size.height);
return;
}
The results of this code are as follows in the console:
in awakeFromNib
the frame is 0, 0, 0, 0
the frame is 0, 1079230464, 0, 1078329344
, (i) ; (ii) , , - ; (iii) " ".
, . , - .
- , ? , , , ?