Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 21st, 2012  |  syntax: None  |  size: 1.85 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. how to check condition for parsed elements in iphone
  2. NSArray *feed3 = (NSArray *)[feed valueForKey:@"type"];  
  3. NSLog(@" %@",feed3);
  4.        
  5. if(type==staus){  
  6. //do some thing  
  7. }
  8.        
  9. * the top level object is an array
  10. * every element in the array is an object/dictionary representing news
  11. * this object/dictionary contains the following keys:
  12.   * application (object/dictionary with two keys: id, name)
  13.     * id (number)
  14.     * name (string)
  15.   * created_time (string)
  16.   * from (object/dictionary with two keys: id, name)
  17.     * id (number)
  18.     * name (string)
  19.   * icon (string)
  20.   * id (string)
  21.   * likes (object/dictionary with two keys: count, data)
  22.     * count (number)
  23.     * data (array)
  24.       * every element in the array is an object/dictionary
  25.       * this object/dictionary has two keys (id, name)
  26.         * id (number)
  27.         * name (string)
  28.   * link (string)
  29.   * name (string)
  30.   * picture (string)
  31.   * properties (array of objects/dictionaries)
  32.   * type (string)
  33.   * updated_time (string)
  34.        
  35. for (NSDictionary *news in feed3) {
  36.     NSString *type = [news objectForKey:@"type"];
  37.  
  38.     if ([type isEqualToString:@"status"]) {
  39.        …
  40.     }
  41.     else if ([type isEqualToString:@"photo"]) {
  42.        …
  43.     }
  44.     else if ([type isEqualToString:@"link"]) {
  45.        …
  46.     }
  47.     else if ([type isEqualToString:@"video"]) {
  48.        …
  49.     }
  50. }
  51.        
  52. for(int index = 0 ; index < [feed3 count] ; index++)
  53. {
  54.     NSString* tempString = [feed3 objectAtIndex:index];
  55.  
  56.     if([tempString isEqualToString:@"status"])
  57.     {
  58.       //Get value for status from value array
  59.     }
  60.     else if([tempString isEqualToString:@"photo"])
  61.     {
  62.       //Get value for photo from value array
  63.     }
  64.     else if([tempString isEqualToString:@"link"])
  65.     {
  66.       //Get value for link from value array
  67.     }
  68.     else if([tempString isEqualToString:@"video"])
  69.     {
  70.       //Get value for video from value array
  71.     }
  72. }