【问题标题】:Accessing the NSArray values of the NSDictionary访问 NSDictionary 的 NSArray 值
【发布时间】:2011-06-10 17:35:37
【问题描述】:

我正在使用 MWFeedParser 将 url 引入表格视图。我已经阅读了文档,发现我可以访问 item.enclosures(NSDictionary 的 NSArray,带有键 url、类型和长度)。我想从数组中访问 URL。我需要帮助弄清楚如何访问 NSDictionary 的 NSArray 值,这就是我目前所拥有的。

if (indexPath.section == SectionHeader && indexPath.row == SectionHeaderEnclosure) {
    if (item.enclosures) {
        for (NSDictionary *url in item.enclosures){
            //How to access here;
        }
    }
}

【问题讨论】:

    标签: iphone objective-c xcode4 nsarray nsdictionary


    【解决方案1】:
    if (indexPath.section == SectionHeader && indexPath.row == SectionHeaderEnclosure) {  
        if (item.enclosures) {  
            for (NSDictionary *dict in item.enclosures){  
                NSString *url = [dict objectForKey:@"url"];  
                NSLog(@" url is : %@",url);  
            }  
        }  
    }  
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-06-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-10
      • 2011-01-17
      相关资源
      最近更新 更多