UITableView 用于显示 xml 解析数据的行数是多少?
我是 iPhone 应用程序开发新手,所以请任何人帮助我。我的主要问题是
--> 解析 xml 后,我将 xml 的属性值插入 nsarray 中,其中 nsarray 是 nsmutable 数组的对象。类似的东西...
[records addObject:[NSArray arrayWithObjects:
[TBXML textForElement:visitor],
[TBXML textForElement:uniqueVisitor],
[TBXML textForElement:order],
[TBXML textForElement:revenue],
[TBXML textForElement:conversionRate],
[TBXML textForElement:newProduct],
[TBXML textForElement:outOfStockProduct],
[TBXML textForElement:productInCart],
[TBXML textForElement:visitorInc],
[TBXML textForElement:uniqueVisitorInc],
[TBXML textForElement:orderInc],
[TBXML textForElement:revenueInc],
[TBXML textForElement:conversionRateInc],
[TBXML textForElement:newProductInc],
[TBXML textForElement:outOfStockProductInc],
[TBXML textForElement:productInCartInc],nil]];
现在我想在 uitableview 的每个单元格中逐一显示每个属性值。但我不知道节方法中的行数是多少。请任何人帮助我。我正在给示例代码...
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection: (NSInteger)section{
NSLog(@"The number of row in the object array: %d ",[records count]);
return [records count];
}
tableview 方法在这里...现在告诉我在每个单元格中一一显示所有属性值的返回类型是什么。
提前致谢。
i am newer to iphone application development so please anybody help me.my main problem is
-->after parsed the xml i am inserting attribute value of the xml in a nsarray which nsarray is an object of nsmutable array. something like that...
[records addObject:[NSArray arrayWithObjects:
[TBXML textForElement:visitor],
[TBXML textForElement:uniqueVisitor],
[TBXML textForElement:order],
[TBXML textForElement:revenue],
[TBXML textForElement:conversionRate],
[TBXML textForElement:newProduct],
[TBXML textForElement:outOfStockProduct],
[TBXML textForElement:productInCart],
[TBXML textForElement:visitorInc],
[TBXML textForElement:uniqueVisitorInc],
[TBXML textForElement:orderInc],
[TBXML textForElement:revenueInc],
[TBXML textForElement:conversionRateInc],
[TBXML textForElement:newProductInc],
[TBXML textForElement:outOfStockProductInc],
[TBXML textForElement:productInCartInc],nil]];
now i want to display each attribute value one bye one in every cell of the uitableview.but i do not know what will be the number of rows in a section method.please any body help me.i am giving the sample code....
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection: (NSInteger)section{
NSLog(@"The number of row in the object array: %d ",[records count]);
return [records count];
}
tableview method is here...now tell me what will be the return type for displaying all the attribute value one bye one in every cell.
Thanks in Advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以为每个字段创建一个标签,并将其添加到 cellForRowAtIndexPath 中的单元格中,轮廓为:
当然,您需要计算每个字段的大小以及屏幕中的总长度。
You could create a label for each field and add it to the cell in cellForRowAtIndexPath, the outline being :
Of course you'll need to work the size for each field and the total length in the screen.