where to empty an array in this situation in iphone
I am making a project..
In that I am using a viewController and a tableViewController..
I am declaring two array here, In viewController array1 and in tableViewcontroller array 2
Now I am assinging an array in a view controller and I am giving the values of array 1 to the array 2 in view controller and I am showing that one in the tableViewController
Now my problem is when I am navigating between this two view every time array is added up in the table view..
so what happens is array is added up every time..
so where should i do remov开发者_如何学JAVAeAllObject process??
In your table view controller make an property for the array.
@interface DetailedAddViewController : UITableViewController{
NSArray *dataSourceArray;
}
@property (nonatomic, retain) NSArray *dataSourceArray;
@end
And in m file don't forget to add
@synthesize dataSourceArray;
And in dealloc method to release it
[addDictionary release];
Declared Properties doc
Possibly you are switching from one view controller to another.So the view controller loading again.In viewDidload method,initialize a flag and remove an array inside the flag.
精彩评论