• 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
Stacking run loops
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Stacking run loops


  • Subject: Stacking run loops
  • From: Ricky Sharp <email@hidden>
  • Date: Wed, 15 Dec 2004 19:48:39 -0600

I've got a non-typical app (kiosk) that has one and only one window. The contents of the window are what I call a "screen".

For the sake of discussion, let's say there are only two screens: "main" and "about dialog".

Upon app startup, the main screen UI is presented and managed by a controller. When the "about" button is clicked, I want to "run" the about dialog, but do so with a blocking call.

Here are two methods I've implemented in my app controller:

- (void)runDialogScreen:(int)aScreenID
{
	[self pushScreen:aScreenID];

	CFRunLoopRun();

	[self popScreen];
}


Here, pushScreen: will load a nib for the given screen ID. That nib's owner is a controller for that particular screen (in this case the about dialog).


After the nib is loaded, the main window's content view is replaced with the content view from a well-named panel object in the nib (the about dialog UI).

The controller for the about dialog then has an IBAction for okButtonPressed. In that method, I call the app controller's endDialogScreen:

- (void)endDialogScreen
{
	CFRunLoopStop ([[NSRunLoop currentRunLoop] getCFRunLoop]);
}


As you can see, the thought it to push the about screen, block and process events, then after the loop is stopped, the about screen is popped. This will then reload the original controller/nib in my screen stack (the main screen for this example).


Problem: CFRunLoopRun is returning immediately. Note that this is supposed to be functionally equivalent to [[NSRunLoop currentRunLoop] run].

I've been trying to search for potential examples of stacked run loops, but have come up empty.

The docs, while very detailed, are a bit confusing to me. It explains without a doubt that run loops can be stacked and it makes it sound like you just would need to do a CFRunLoopRun. But it also explains that if it returns immediately, that there are no input sources to process.

Does one have to figure out what input sources to add to a nested (stacked) run loop? I had thought that running the current run loop using the default mode was suppose to do this for you.

Any examples or pointers on how to effectively stack run loops would be greatly appreciated.

___________________________________________________________
Ricky A. Sharp         mailto:email@hidden
Instant Interactive(tm)   http://www.instantinteractive.com

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Using Security framework to get root auth for running app.
  • Next by Date: Embedding binary data in an application's property list
  • Previous by thread: Re: Controlling control sizes when programatically resizing a window
  • Next by thread: Re: Stacking run loops
  • Index(es):
    • Date
    • Thread