【发布时间】:2011-05-21 00:35:12
【问题描述】:
我需要以下代码的帮助,我正在使用 hpple 解析 html。 我需要帮助使用这些数据。
-(void) whatever{
NSData *htmlData = [[NSString stringWithContentsOfURL:[NSURL URLWithString: @"http://www.objectgraph.com/contact.html"]] dataUsingEncoding:NSUTF8StringEncoding];
TFHpple *xpathParser = [[TFHpple alloc] initWithHTMLData:htmlData];
NSArray *titles = [xpathParser search:@"//h3"]; // get the page title - this is xpath notation
TFHppleElement *title = [titles objectAtIndex:0];
NSString *myTitles = [title content];
NSArray *articles = [xpathParser search:@"//h4"]; // get the page article - this is xpath notation
TFHppleElement *article = [articles objectAtIndex:0];
NSString *myArtical = [article content];
我想从数组“titles”中创建和填充一个表 然后可以点击表格上的项目来加载一个子视图,该子视图应该在同一索引处显示相应的文章?
我想以编程方式或使用 IB 进行此操作
谁能推荐一些示例代码或教程?
谢谢。
【问题讨论】:
标签: iphone arrays uitableview ios loops