It looks like you're new here. If you want to get involved, click one of these buttons!
- (void)handleSearchForTerm:(NSString *)searchTerm{
NSMutableArray *sectionsToRemove;
NSMutableArray *lclArray;
NSMutableArray *toRemove;
NSString *key;
NSString *altSearchTerm;
NSString *name;
altSearchTerm = @\"the \";
altSearchTerm = [altSearchTerm stringByAppendingString:searchTerm];
sectionsToRemove = [[NSMutableArray alloc] init];
[self resetSearch];
for (key in self.listEditData) {
lclArray = (NSMutableArray *)listData;
toRemove = [[NSMutableArray alloc] init];
for (name in lclArray) {
if ([name rangeOfString:searchTerm
options:NSCaseInsensitiveSearch].location != 0
&& [name rangeOfString:altSearchTerm
options:NSCaseInsensitiveSearch].location != 0)
[toRemove addObject:name];
}
if ([lclArray count] == [toRemove count]){
[sectionsToRemove addObject:key];
}
[lclArray removeObjectsInArray:toRemove];
}
[self.listEditData removeObjectsInArray:sectionsToRemove];
[myTableView reloadData];
}
Replies
What is self.listEditData declared as and where is it created or set?
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeAny ideas?
PJ
pdahill_at_gmail.com
Follow my romp through the world of finding a contract job in this economy on Twitter at "HiTechJobSeeker"
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeI used the list of dwarves lamarche added for testing.
pdahill_at_gmail.com
Follow my romp through the world of finding a contract job in this economy on Twitter at "HiTechJobSeeker"
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeP.J.
pdahill_at_gmail.com
Follow my romp through the world of finding a contract job in this economy on Twitter at "HiTechJobSeeker"
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesomecopy of an NSArray is an NSArray
mutableCopy of NSArray is an NSMutableArray
copy of an NSMutableArray is NSArray (!)
mutableCopy of an NSMutableArray is an NSMutableArray
One of those can trick you, so keep it that mind.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- (void)handleSearchForTerm:(NSString *)searchTerm{
// change toRemove to reducedArray
NSMutableArray *lclArray;
NSMutableArray *reducedArray;
NSString *altSearchTerm;
NSString *name;
altSearchTerm = @\"the \";
altSearchTerm = [altSearchTerm stringByAppendingString:searchTerm];
[self resetSearch];
lclArray = (NSMutableArray *)listData;
reducedArray = [[NSMutableArray alloc] init];
for (name in lclArray) {
if ([name rangeOfString:searchTerm
options:NSCaseInsensitiveSearch].location == 0
|| [name rangeOfString:altSearchTerm
options:NSCaseInsensitiveSearch].location == 0)
[reducedArray addObject:name];
}
self.listEditData = reducedArray;
[myTableView reloadData];
}
pdahill_at_gmail.com
Follow my romp through the world of finding a contract job in this economy on Twitter at "HiTechJobSeeker"
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome