Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

CeiJay

macrumors newbie
Original poster
Jul 17, 2010
15
0
I have an NSMutableArray holding Moving Files which load into the player depending on the cell indexPath. The retain method below does the job in retaining the cell, its title and the file all together when moved. Yet when I push a new view within UINavigation I retain is lost.

What is the best way to retain an array throughout the app when using tableView:moveRowAtIndexPath:toIndexPath:

My Array

Code:
if (filmMovie == nil)
    {
        NSMutableArray *array = [[NSMutableArray alloc] initWithObjects:
                                                                 @"Mov1.mov", 
								 @"Mov2.mov", 
								 @"Mov3.mov", 
								 @"Mov4.mov", 
								 @"Mov5.mov", 
								 @"Mov6.mov", 
                                                                 @"Mov7.mov", 
								 @"Mov8.mov", 
								 @"Mov9.mov", 
								 @"Mov10.mov", nil];
        self.filmMovie = array;
        [array release];        
    }

My Retain

Code:
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
    NSUInteger fromRow = [fromIndexPath row];
    NSUInteger toRow = [toIndexPath row];
    
    id object = [[filmMovie objectAtIndex:fromRow] retain];
    [filmMovie removeObjectAtIndex:fromRow];
    [filmMovie insertObject:object atIndex:toRow];
    [object release];
}

Thoughts?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.