title: Creating contact list with sorted names and images from MySQL
body: <p>everybody. Right now i'm trying to make an UITableView which have alphabetically sorted contact names and profile picture. Just like this image:<img src="https://i.stack.imgur.com/so3qw.jpg" alt="Contact list">
  The site that provide this image showed me how to make something like this, but i had problem since in my app we don't have static images but using MySQL database to provide the saved contact. I able to grab the data needed via web service and put it in NSDictionary named dataDict. In NSLog, it showed like this:</p>
  
  <pre><code>animal={(id="1",name="BEAR",images="bear321.jpg"),(id="2",name="Dog",images="puppy.jpg"),(id="3",name="GOOSE",images="null"),...so on}
  </code></pre>
  
  <p>Since i don't know how to parse the dictionary i have, right now i'm still using this code:- </p>
  
  <pre><code>(void)viewDidLoad
  {
      [super viewDidLoad];
  
      animals = @{@"B" : @[@"Bear", @"Black Swan", @"Buffalo"],
                  @"C" : @[@"Camel", @"Cockatoo"],
                  @"D" : @[@"Dog", @"Donkey"],
                  @"E" : @[@"Emu"],
                  @"G" : @[@"Giraffe", @"Greater Rhea"],
                  @"H" : @[@"Hippopotamus", @"Horse"],
                  @"K" : @[@"Koala"],
                  @"L" : @[@"Lion", @"Llama"],
                  @"M" : @[@"Manatus", @"Meerkat"],
                  @"P" : @[@"Panda", @"Peacock", @"Pig", @"Platypus", @"Polar Bear"],
                  @"R" : @[@"Rhinoceros"],
                  @"S" : @[@"Seagull"],
                  @"T" : @[@"Tasmania Devil"],
                  @"W" : @[@"Whale", @"Whale Shark", @"Wombat"]};
  
      animalSectionTitles = [[animals allKeys] sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
  }
  
  - (NSString *)getImageFilename:(NSString *)animal
  {
      NSString *imageFilename = [[animal lowercaseString] stringByReplacingOccurrencesOfString:@" " withString:@"_"];
      imageFilename = [imageFilename stringByAppendingString:@".jpg"];
  
      return imageFilename;
  }
  
  - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  {
      // Return the number of rows in the section.
      NSString *sectionTitle = [animalSectionTitles objectAtIndex:section];
      NSArray *sectionAnimals = [animals objectForKey:sectionTitle];
      return [sectionAnimals count];
  }
  - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
      UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
  
      // Configure the cell...
      NSString *sectionTitle = [animalSectionTitles objectAtIndex:indexPath.section];
      NSArray *sectionAnimals = [animals objectForKey:sectionTitle];
      NSString *animal = [sectionAnimals objectAtIndex:indexPath.row];
      cell.textLabel.text = animal;
      cell.imageView.image = [UIImage imageNamed:[self getImageFilename:animal]];
  
      return cell;
  }
  </code></pre>
  
  <p>Exactly the same <a href="http://www.appcoda.com/ios-programming-index-list-uitableview/" rel="nofollow noreferrer">like this site</a> So please help me solve my problem by tell me what i need to modify so i can add picture name and image based on my dynamic dictionary instead of hardcoded like the above. Thanks a lot in advance ^^</p>