5
我正在閱讀RSS feed到nsmutablearray。我想搜索xml提要。因爲我想搜索nsmutablearray。我對iphone應用程序很陌生。可有一個人helpme這個..如何在目標c-iPhone應用程序中搜索nsmutablearray
感謝,
我正在閱讀RSS feed到nsmutablearray。我想搜索xml提要。因爲我想搜索nsmutablearray。我對iphone應用程序很陌生。可有一個人helpme這個..如何在目標c-iPhone應用程序中搜索nsmutablearray
感謝,
你可以使用謂詞陣列的「搜索」,像這樣:
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。
添加文檔鏈接 – 2009-07-01 05:18:42