- (NSString *)stringFormDict:(NSDictionary*)dict

 {

     NSMutableString *str = [NSMutableString string];

     NSArray *keys = [dict allKeys];

     for (NSString *key in keys) {

         if ([[dict objectForKey:key] isKindOfClass:[NSDictionary class]]) {

             id obj = [dict objectForKey:key];

             [str appendFormat:@"\n%@: %@",key,[self stringFormDict:obj]];

  }else if ([[dict objectForKey:key] isKindOfClass:[NSArray class]]){

             [str appendFormat:@"\n%@:",key];

for (id obj in [dict objectForKey:key]) {

                 [str appendFormat:@"\n%@",[self stringFormDict:obj]];

             }

         }else{

             [str appendFormat:@"\n%@: %@",key,[dict objectForKey:key]];

         }

     }

     return str;

 }

 

    全站熱搜

    戮克 發表在 痞客邦 留言(0) 人氣()