NSMutableArray setArray
- (void)setArray:(NSArray *)otherArray
Parameters of [NSMutableArray setArray]
otherArray
The array of objects with which to replace the receiving array's content.
NSMutableArray setArray example.
-(IBAction)selectTab:(id)sender {
if ([(UIButton*)sender tag] == 1000) {
if (![self.butonLocuri isSelected]) {
[tableDataSourceArray setArray:locuriArray];
[self addPins:self.tableDataSourceArray];
[self.myTableView reloadData];
}
}
if ([(UIButton*)sender tag] == 2000) {
if(![self.butonEvenimente isSelected]){
[tableDataSourceArray setArray:evenimenteArray];
[self addPins:self.tableDataSourceArray];
[self.myTableView reloadData];
}
}
}
if ([(UIButton*)sender tag] == 1000) {
if (![self.butonLocuri isSelected]) {
[tableDataSourceArray setArray:locuriArray];
[self addPins:self.tableDataSourceArray];
[self.myTableView reloadData];
}
}
if ([(UIButton*)sender tag] == 2000) {
if(![self.butonEvenimente isSelected]){
[tableDataSourceArray setArray:evenimenteArray];
[self addPins:self.tableDataSourceArray];
[self.myTableView reloadData];
}
}
}
Example of [NSMutableArray setArray].
-(id)copyWithZone:(NSZone*)zone
{
Condition *copy = [[[self class]allocWithZone:zone]init];
NSArray *copiedArray = [[NSArray alloc]initWithArray:self.subConditions copyItems:YES];
[copy.subConditions setArray:copiedArray];
[copiedArray release];
return copy;
}
{
Condition *copy = [[[self class]allocWithZone:zone]init];
NSArray *copiedArray = [[NSArray alloc]initWithArray:self.subConditions copyItems:YES];
[copy.subConditions setArray:copiedArray];
[copiedArray release];
return copy;
}
NSMutableArray setArray example.
NSMutableArray *array = ...
NSMutableArray *itemsToKeep = [NSMutableArray arrayWithCapacity:[array count]];
for (id object in array) {
if (! shouldRemove(object)) {
[itemsToKeep addObject:object];
}
}
[array setArray:itemsToKeep];
NSMutableArray *itemsToKeep = [NSMutableArray arrayWithCapacity:[array count]];
for (id object in array) {
if (! shouldRemove(object)) {
[itemsToKeep addObject:object];
}
}
[array setArray:itemsToKeep];