• 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
Delete record
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Delete record


  • Subject: Delete record
  • From: Michèle Garoche <email@hidden>
  • Date: Wed, 19 Dec 2001 05:50:51 +0100

From a newbie:

In Travel Advisor (Learning Cocoa - chapter 10), I've implemented as mentioned below the method to delete a record.

Could someone tell me if it is the right way to do it?

Many thanks in advance.

- (IBAction)deleteRecord:(id)sender
{
Country *aCountry;
NSString *countryName = [countryField stringValue];

// Retrieve the key
aCountry = [countryDict objectForKey:countryName];
// Is there an entry in the dictionary for this key?
if (!aCountry)
{
return;
}
// Remove the entry in the dictionary
[countryDict removeObjectForKey:countryName];
[countryKeys removeObject:countryName];

// Sort array and update table view
[countryKeys sortUsingSelector:@selector(compare:)];
[countryTableView reloadData];

[self blankFields:self];

[countryField selectText:self];
}


  • Prev by Date: Validate a user entry
  • Next by Date: NSDateFormatter bug?
  • Previous by thread: Re: Validate a user entry
  • Next by thread: NSDateFormatter bug?
  • Index(es):
    • Date
    • Thread