So I have one NSArray that has names of documents to be presented in a UITableView. The NSStrings in the NSArray have spaces so an entry would look like, “John Smith”. Then I have pdfs that correspond to each of the table entries. These pdf entries are not the same name. They would be something like, “JohnSmith.pdf”. I created a method to basically convert the names to the pdfs in order to present the appropriate pdfs. In my method, I basically hard coded the values
NSUInteger loopCount = 0;
for ( ; loopCount < [array count]; loopCount++) {
if ([[array objectAtIndex:loopCount] isEqualToString:@"John Smith"]) {
[array replaceObjectAtIndex:loopCount withObject:@"JohnSmith.pdf"];
}
}
Is there a better way to do this? That’s all I could think of since the data was already made to have different names. Thx.
maybe you can use something like this: