cocoa-sheet

How to show an NSWindow as sheet at specific location

丶灬走出姿态 提交于 2020-01-15 11:40:19
问题 I have a window like this, having 3 subviews, each one of them has button. On click of those- I need to show sheet. By using this code, sheet comes in centre of the window. - (IBAction)closeSubWindow:(id)sender{ [NSApp endSheet:self.subWindow]; [self.subWindow orderOut:nil]; } - (IBAction)showSubWindow:(id)sender { [NSApp beginSheet:self.subWindow modalForWindow:self.window modalDelegate:self didEndSelector:nil contextInfo:nil]; } Is there any option or way to show the sheet at specific co

beginSheet: block alternative?

邮差的信 提交于 2020-01-02 09:57:22
问题 Didn't Snow Leopard introduce some alternative to the old beginSheet: method that allows using a block to do the finishing stuff? I don't like having it in another callback method. 回答1: Never mind. I found what I'm looking for at these two sites: http://www.mikeash.com/pyblog/friday-qa-2009-08-14-practical-blocks.html, http://www.cocoabuilder.com/archive/cocoa/281058-sheets-blocks-and-garbage-collector.html In fact, this is the code, and it's fully compatible with both GC and non-GC:

Why isn't my sheet attached to the window it's run for?

ぐ巨炮叔叔 提交于 2019-12-31 17:53:00
问题 I have a NIB which contains two windows, one is the app's main window visible at launch and the other is a custom sheet (and therefore not visible at launch). When the sheet is required my controller calls: [NSApp beginSheet: sheetWindow modalForWindow: mainWindow modalDelegate: self didEndSelector: @selector(didEndSheet:returnCode:contextInfo:) contextInfo: nil]; which displays the sheet window and starts a modal session, but the window has a standard Aqua title bar, is not 'connected' to

Can a view controller own a sheet?

为君一笑 提交于 2019-12-13 19:19:54
问题 I want to call a sheet from within a view controller (user clicks on a button and the sheet will be displayed). Can the sheet have a separate window controller (with outlets and actions) or does the view controller from which the sheet is called operate as the sheet's controller? I'm trying to determine how to display a sheet from a separate Interface Builder (.xib) file than my view controller. The sheet will have a list based on a popup menu item, so I would like to put that "logic" in a

Cocoa: NSApp beginSheet sets the application delegate?

那年仲夏 提交于 2019-12-11 01:21:40
问题 I am trying to display a custom sheet in my application, but I think I am doing something wrong. While everything seems to be working just fine, I have a rather odd side-effect. (which took hours to figure out). It turns out that everytime I display a sheet in my application, the Application delegate gets set to the instance of the sheet, thus my Controller gets unset as the delegate causing all sorts of problems. I've created a NIB file which I called FailureSheet.xib. I laid out my

beginSheet: block alternative?

馋奶兔 提交于 2019-12-06 11:24:33
Didn't Snow Leopard introduce some alternative to the old beginSheet: method that allows using a block to do the finishing stuff? I don't like having it in another callback method. Never mind. I found what I'm looking for at these two sites: http://www.mikeash.com/pyblog/friday-qa-2009-08-14-practical-blocks.html , http://www.cocoabuilder.com/archive/cocoa/281058-sheets-blocks-and-garbage-collector.html In fact, this is the code, and it's fully compatible with both GC and non-GC: @implementation NSApplication (SheetAdditions) - (void)beginSheet:(NSWindow *)sheet modalForWindow:(NSWindow *

How to show a NSPanel as a sheet

十年热恋 提交于 2019-12-05 22:52:41
问题 I'm trying to show a NSPanel as a sheet. I'm naively doing something along those lines: SheetController *sheetController = [[[SheetController alloc] initWithWindowNibName:@"Sheet"] autorelease]; [[NSApplication sharedApplication] beginSheet:sheetController.window modalForWindow:self.window modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:nil]; For some reason that eludes me, this isn't working. When this part of the code is called, the sheet

beginSheet: block alternative with ARC?

独自空忆成欢 提交于 2019-12-04 07:27:18
Mike Ash created an example of using blocks to handle callbacks from sheets, which seems very nice. This was in turn updated to work with garbage collection by user Enchilada in another SO question at beginSheet: block alternative? , see below. @implementation NSApplication (SheetAdditions) - (void)beginSheet:(NSWindow *)sheet modalForWindow:(NSWindow *)docWindow didEndBlock:(void (^)(NSInteger returnCode))block { [self beginSheet:sheet modalForWindow:docWindow modalDelegate:self didEndSelector:@selector(my_blockSheetDidEnd:returnCode:contextInfo:) contextInfo:Block_copy(block)]; } - (void)my

How to show a NSPanel as a sheet

老子叫甜甜 提交于 2019-12-04 04:16:08
I'm trying to show a NSPanel as a sheet. I'm naively doing something along those lines: SheetController *sheetController = [[[SheetController alloc] initWithWindowNibName:@"Sheet"] autorelease]; [[NSApplication sharedApplication] beginSheet:sheetController.window modalForWindow:self.window modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:nil]; For some reason that eludes me, this isn't working. When this part of the code is called, the sheet momentarily flashes (because of the autorelease message). The sheet is never hooked to window. If anyone can

How to show sheet from separate NIB

本小妞迷上赌 提交于 2019-12-04 03:32:37
How do I put a window in a separate NIB, give it its own NSWindowController, make it slide out as a sheet? (Is this a typical thing to do with sheets?) I am trying to show a custom sheet (a window that slides down from the title bar of the parent window) from my main window. What I'm trying to do is standard, I think, but I cannot find clear examples or explanations for how to do exactly what I want. What I am trying to do: My app delegate owns the main window, which has a button to open a "settings" sheet. The "settings" sheet: is in a separate NIB. has file owner set to class