• 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: Help with Basics (Was: help with bindings)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with Basics (Was: help with bindings)


  • Subject: Re: Help with Basics (Was: help with bindings)
  • From: Ricky Sharp <email@hidden>
  • Date: Sun, 21 Nov 2010 06:09:51 -0600

On Nov 21, 2010, at 2:59 AM, Rounak Jain wrote:

> Thanks Jerry,
> I have used the dictionaryWithObjectsAndKeys: method.
> I have implemented your suggestions regarding "convenience constructors" and myKeys object. Regarding your comment about making everything "mutable", I think, at the moment, it has to be that way.
> What's next?

As Jerry pointed out, you need to learn the basics; please read up on the basics to include memory management.

The way you've now written things will cause your app to crash.  I'll leave the reason for the crash as an exercise for you to figure out.

> #import <Cocoa/Cocoa.h>
>
> @interface ComboscAppDelegate : NSObject <NSApplicationDelegate> {
> 	IBOutlet NSComboBox *countryCombo;
> NSMutableDictionary *theCountries;
> 	NSMutableArray *myKeys;
> 	IBOutlet NSWindow *window;
> }
> @property (assign) IBOutlet NSWindow *window;
> - (void)applicationWillFinishLaunching:(NSNotification *)notif;
> @end
>
>
>
> #import "ComboscAppDelegate.h"
> @implementation ComboscAppDelegate
>
> @synthesize window;
> - (void)applicationWillFinishLaunching:(NSNotification *)notif {
>    theCountries = [NSMutableDictionary dictionaryWithObjectsAndKeys:
> 					 [NSMutableArray arrayWithObjects:@"AAABBB", @"AABBB", @"AAACCC", nil], @"A",
> 					 [NSMutableArray arrayWithObjects:@"BBBAAA", @"BBBBBBBB", @"BBBCCC", nil], @"B",
> 					 [NSMutableArray arrayWithObjects:@"CCCDDD", @"CCFGGGFF", @"CCCDDDFFF", nil], @"C", nil];
>
> 	myKeys = [NSMutableArray arrayWithObjects: [theCountries allKeys], nil];
> }
> @end

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



_______________________________________________

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

References: 
 >Re: Help with Basics (Was: help with bindings) (From: Rounak Jain <email@hidden>)

  • Prev by Date: Re: NSExpression is incorrect?
  • Next by Date: Re: Help with Basics
  • Previous by thread: Re: Help with Basics (Was: help with bindings)
  • Next by thread: Re: Help with Basics
  • Index(es):
    • Date
    • Thread