• 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
A Question of Style
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A Question of Style


  • Subject: A Question of Style
  • From: Andrew Satori <email@hidden>
  • Date: Mon, 7 Aug 2006 21:40:29 -0400

So I've got this framework and it works, but I've decided to clean it up and make it publicly available, there is however a segment of code that I question if it's really done in Cocoa Style, and I'm looking for best practices from the more experienced Cocoa Devs.

I have a class in the framework that encapsulates and displays a login panel modal for a parent window.

At the moment, it using a method that takes an id for a controller for the parent window controller, an NSWindow * for the parent window and a selector for the selector to be invoked upon completion so for example:

@interface EXSomeLogin : NSObject {

  ...
  SEL onCompleteSelector;
  id parentController;

}

-(id)runModalForWindow:(NSWindow *)parentWindow
	withController:(id)controller
 performOnComplete:(SEL)completeSelector;

-(IBAction)onDialogComplete:(id)sender;

@end

In the runModalForWindow function, I set the members as passed in:

	onCompleteSelector = completeSelector;
	parentController = controller;

and then do the usual modal display for the panel (loading the nib etc).

When the onDialogComplete happens, I then do my work inside the framework (and set the Class members accordingly) then I call back to the parentController using the selector passed in:

[parentController performSelector:onCompleteSelector withObject:self afterDelay:0.0];

My concern is style. Is this a normal usage pattern or am I over complicating something ?

Your thoughts appreciated!


D.
_______________________________________________
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
  • Follow-Ups:
    • Re: A Question of Style
      • From: Daniel Jalkut <email@hidden>
  • Prev by Date: Re: Crashing on all relevant exceptions
  • Next by Date: Re: Crashing on all relevant exceptions
  • Previous by thread: Re: Finding moved files by file descriptor or inode
  • Next by thread: Re: A Question of Style
  • Index(es):
    • Date
    • Thread