• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Close Modal window after sheet ends
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Close Modal window after sheet ends


  • Subject: Re: Close Modal window after sheet ends
  • From: Alex Kac <email@hidden>
  • Date: Mon, 24 Aug 2015 11:53:40 -0600

I’ve also tried this…and the code in the dispatch_async never gets called. I’ve seen other code on github that does something similar so obviously it *should* work.

- (IBAction)enterRegCode:(id)sender {

	registrationWindowController = [[RegistrationWindow alloc] initWithWindowNibName:@"RegistrationWindow"];

	__weak PIIntroWindowController* weakSelf = self;

	[self.window beginSheet:registrationWindowController.window completionHandler:^(NSModalResponse returnCode) {
		registrationWindowController = nil;

		if (returnCode == 1)
		{
			quitMeansCloseWindow = YES;
			dispatch_async(dispatch_get_main_queue(), ^{
				NSLog(@“Do I get called?”);
			});
		}

	}];

}


> On Aug 24, 2015, at 11:41 AM, Alex Kac <email@hidden> wrote:
>
> I’ve got a modal window which opens a sheet to let the user enter a registration code. If the Reg code is accepted, I want to close the window after the sheet ends. However it doesn’t. I’ve tried a ton of different things and I believe it has something to do with the runLoop because dispatch timers, async, etc… do not work in the completionHandler at all. Neither does performSelector:afterDelay:. Nothing that seems to use a timer works.
>
> Here is how I present the main window:
> [[NSApplication sharedApplication] runModalForWindow:introSheetController.window];
>
> and then when the user selects “Enter Registration Code”:
>
> - (IBAction)enterRegCode:(id)sender {
>
> 	registrationWindowController = [[RegistrationWindow alloc] initWithWindowNibName:@"RegistrationWindow"];
>
> 	[self.window beginSheet:registrationWindowController.window completionHandler:^(NSModalResponse returnCode) {
> 		registrationWindowController = nil;
>
> 		if (returnCode == 1)
> 		{
> 			[[NSApplication sharedApplication] stopModal];
> 			[self.window close];
> 			//[self.window orderOut:nil]
> 		}
> 	}];
> }
>
> What do you think? I think I know what’s wrong, but I’ve tried enough things that don’t work that I’m sure its something basic and simple.


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Close Modal window after sheet ends
      • From: Quincey Morris <email@hidden>
    • Re: Close Modal window after sheet ends
      • From: Ken Thomases <email@hidden>
References: 
 >Close Modal window after sheet ends (From: Alex Kac <email@hidden>)

  • Prev by Date: Close Modal window after sheet ends
  • Next by Date: Re: Close Modal window after sheet ends
  • Previous by thread: Close Modal window after sheet ends
  • Next by thread: Re: Close Modal window after sheet ends
  • Index(es):
    • Date
    • Thread