My own Bronze,Sliver and Golden solution


Here is my own [size=150]Bronze,Sliver and Golden solution[/size] (Only code segment)

[size=150] Bronze[/size]
In BNRItemsViewController.m

[code]- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath{

return @“Remove”;

In BNRItemStore.m
Add a NSString object into privateItems,and always keep it in the bottom in the array.

[code]- (instancetype)initPrivate{

self = [super init];


    _privateItems = [[NSMutableArray alloc] init];
    [_privateItems addObject:@"No more items..."];

return self;


  • (BNRItem *)createItem{

    BNRItem *item = [BNRItem randomItem];

    // Keep NSString object “No more items…” at the bottom of array
    [self.privateItems insertObject:item atIndex:[self.privateItems count]-1];

    return item;


In In BNRItemsViewController.m

[code]- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath{

// Insure the last row can not be edited
if (indexPath.row == ([[[BNRItemStore sharedStroe] allItems] count] - 1)) {
    return NO;
    return YES;


// Move Object

  • (void)tableView:(UITableView *)tableView
    moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath
    toIndexPath:(NSIndexPath *)destinationIndexPath{

    [[BNRItemStore sharedStroe] moveItemAtIndex:sourceIndexPath.row toIndex:destinationIndexPath.row];

    // Refresh Data
    [tableView reloadData];


In BNRItemStore.m

[code]- (void)moveItemAtIndex:(NSUInteger)fromIndex toIndex:(NSUInteger)toIndex{

// Return when move the last row
if(fromIndex == toIndex || (toIndex == [self.privateItems count] - 1)){


BNRItem *item = self.privateItems[fromIndex];

[self.privateItems removeObjectAtIndex:fromIndex];

[self.privateItems insertObject:item atIndex:toIndex];