objective c - Setting NSWindow position in current screen -
i newbie in objective-c.i have created main window want display in right bottom of current screen. tried following code
- (void)windowdidload { nspoint pos; pos.x = [[nsscreen mainscreen] visibleframe].origin.x + [[nsscreen mainscreen] visibleframe].size.width - [mywindow frame].size.width ; pos.y = [[nsscreen mainscreen] visibleframe].origin.y + [[nsscreen mainscreen] visibleframe].size.height - [mywindow frame].size.height; [mywindow setframetopleftpoint:pos]; }
what wrong in it? how resolve it?
use
nspoint pos; pos.x = [[nsscreen mainscreen] frame].size.width - [mywindow frame].size.width ; pos.y = 0.0f; [self.window setframe:cgrectmake(pos.x, pos.y, [mywindow frame].size.width , [mywindow frame].size.height) display:yes];
because [[nsscreen mainscreen] frame].origin.x 0. , in case of mac screen starts bottom.
Comments
Post a Comment