我想将一个窗口显示为工作表,它完美地运行了以下代码:
[NSApp beginSheet:mySheet
modalForWindow:myWindow
modalDelegate:nil
didEndSelector:NULL
contextInfo:NULL];
然而,有一个小问题:
怎么了?我怎么能解决这个问题?
答案 0 :(得分:8)
刚刚找到它:
在窗口的委托中,我们像这样实现window:willPositionSheet:usingRect:
- (NSRect)window:(NSWindow *)window willPositionSheet:(NSWindow *)sheet
usingRect:(NSRect)rect
{
rect.origin.y += 11; // or as much as we need
return rect;
}