I've had the most stressful 2 days, and I was wondering if there's any experts out there that can tell me a bit about resizing and positioning of NSViews.
Here's what I'm trying to achieve;
I have a login prompt that slides down within a sheet, after a successful login the sheet resizes itself to be smaller so that a little message says that the user is correctly logged in. The user details are saved within a file and when the application starts up again it automatically logs in the user with the details saved.
The problem;
The positioning of the NSView which contains the success message is completely out of position, therefore some controls are off the frame of the sheet. I've being trying to get this to work and I know all my NSRect origin and size's are correct for the NSView to display correctly within the sheet but something somewhere is changing them or I simply haven't coded it right (I'm sure its the second option, but we all don't like to be proved wrong )
Could someone please take a look at the below code and see what I'm doing wrong?
The pictures below are whats happening when the application is in operation, and the other picture is how Ive laid it out in Interface Builder. Im sure you's can judge which one is the correct display!
Thanks in advance for all your help!!!
Here's what I'm trying to achieve;
I have a login prompt that slides down within a sheet, after a successful login the sheet resizes itself to be smaller so that a little message says that the user is correctly logged in. The user details are saved within a file and when the application starts up again it automatically logs in the user with the details saved.
The problem;
The positioning of the NSView which contains the success message is completely out of position, therefore some controls are off the frame of the sheet. I've being trying to get this to work and I know all my NSRect origin and size's are correct for the NSView to display correctly within the sheet but something somewhere is changing them or I simply haven't coded it right (I'm sure its the second option, but we all don't like to be proved wrong )
Could someone please take a look at the below code and see what I'm doing wrong?
Code:
/**
* Changes the login sheet's view
*
*/
- (void)changeLoginSheetView:(NSView *)view animate:(BOOL)animate
{
NSView * blank = [[[[NSView alloc] init] retain] autorelease];
NSRect current = [loginWindow frame];
NSRect new;
[loginWindow setContentView:blank];
/**
* Work out frame stuff
*/
new.origin.x = current.origin.x;
new.origin.y = current.origin.y + (current.size.height - [view frame].size.height);
new.size.width = current.size.width;
new.size.height = [view frame].size.height;
/**
* Show new view
*/
[loginWindow setFrame:[view frame]
display:YES
animate:animate];
[loginWindow setContentView:view];
}
The pictures below are whats happening when the application is in operation, and the other picture is how Ive laid it out in Interface Builder. Im sure you's can judge which one is the correct display!
Thanks in advance for all your help!!!