title: Swipe To Delete TableView Row
body: <p>I have my array:</p>
  
  <pre><code>self.colorNames = [[NSArray alloc] 
  initWithObjects:@"Red", @"Green",
  @"Blue", @"Indigo", @"Violet", nil];
  </code></pre>
  
  <p>I've tried everything I can find, but there's always errors. I want to be able to swipe so that the delete button appears, and then press the delete button and have that row removed.</p>
  
  <p>Full code (everything relating to the table):</p>
  
  <pre><code>// HEADER FILE
  @interface ViewController : UIViewController &lt;UITableViewDelegate, UITableViewDataSource&gt; {
  
    IBOutlet UITableView *tableView;
      NSMutableArray *colorNames;
  
  }
  @property (strong, nonatomic) NSArray *colorNames;
  
  
  @end
  
  // IMPLEMENTATION
  
  #import "ViewController.h"
  
  @implementation ViewController
  
  @synthesize colorNames; 
  
  - (void)viewDidLoad {
  
      [super viewDidLoad];
  
      self.colorNames = [[NSMutableArray alloc] 
      initWithObjects:@"Red", @"Green",
      @"Blue", @"Indigo", @"Violet", nil];
  
      [super viewDidLoad];
      //[tableView setEditing:YES animated:NO];
  }
  
  
  - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
      return 1;
   }
  
  // Customize the number of rows in the table view.
  - (NSInteger)tableView:(UITableView *)tableView  numberOfRowsInSection:(NSInteger)section {
      int count = [colorNames count];
      return count;
  }
  
  - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  
  }  
  
   // Customize the appearance of table view cells.
   - (UITableViewCell *)tableView:(UITableView *)tableView 
   cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  
   static NSString *CellIdentifier = @"Cell";
  
   UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  
   if (cell == nil) {
       cell = [[UITableViewCell alloc]
               initWithStyle:UITableViewCellStyleDefault
               reuseIdentifier:CellIdentifier];
  
   }
       // Configure the cell.
       cell.textLabel.text = [self.colorNames objectAtIndex: [indexPath row]];
  
   return cell;
  
   }
  </code></pre>