【发布时间】:2009-06-29 08:21:52
【问题描述】:
我正在将 RSS 提要读入 nsmutablearray。我想搜索 xml 提要。为此,我想搜索 nsmutablearray。我对 iPhone 应用程序非常陌生。有人可以帮我解决这个问题吗..
谢谢,
【问题讨论】:
标签: iphone objective-c
我正在将 RSS 提要读入 nsmutablearray。我想搜索 xml 提要。为此,我想搜索 nsmutablearray。我对 iPhone 应用程序非常陌生。有人可以帮我解决这个问题吗..
谢谢,
【问题讨论】:
标签: iphone objective-c
您可以使用谓词“搜索”数组,如下所示:
NSMutableArray* names = [NSMutableArray arrayWithObjects:@"Andy", @"Bart", @"Bob", nil];
NSPredicate* predicate = [NSPredicate predicateWithFormat:@"SELF beginswith[c] 'b'"];
NSArray* namesStartingWithB = [names filteredArrayUsingPredicate: predicate];
// namesStartingWithB now contains @"Bart" & @"Bob"
您应该查看NSArray 和NSPredicate 文档以获取更多信息。如果您需要解析 XML 的特定信息(即 RSS 提要),您应该查看 Matt Gallagher 在using libxml2 for XML parsing and XPath queries in Cocoa 上的文章。
【讨论】: