我正在为即将到来的2014年国际足联世界杯iPhone应用程序,并需要使“组和排名”的积分表。这是我到目前为止所取得的成果。

这样做的代码很简单(但还没有完成):
if (index==0) {
label.text = [NSString stringWithFormat:@"GROUP - %d", index+1];
UITextView *text1 = [[UITextView alloc] initWithFrame:CGRectMake(30, 90, 260, 20)];
text1.text = @"TEAM \t\t MP \t W \t D \t L \t GF \t GA \t Pts";
text1.font = [UIFont fontWithName:@"Arial" size:10];
text1.backgroundColor = [UIColor clearColor];
[imgView addSubview:text1];
UILabel *label1 = [[UILabel alloc] initWithFrame:CGRectMake(30, 90, 260, 20)];
label1.text = @"label \t one";
label1.backgroundColor = [UIColor redColor];
//[imgView addSubview:label1];
}
else if (index==1) {
label.text = [NSString stringWithFormat:@"GROUP - %d", index+1];
UILabel *label2 = [[UILabel alloc] initWithFrame:CGRectMake(50, 100, 200, 20)];
label2.text = @"label two";
label2.backgroundColor = [UIColor redColor];
[imgView addSubview:label2];
}所有的数据将来自于我的服务器托管的XML文件。我不需要解析它们,因为我将使用外部类来解析数据。我只想知道开发这个记分板的最好方法是什么。
我的记分板应该是这样的:
TEAM MP W D L GF GA Pts
[country1.png] Argentina 3 3 0 0 7 1 9
[country2.png] Korea Republic 3 1 1 1 5 6 4
[country3.png] Greece 3 1 0 2 2 5 3
[country4.png] Nigeria 3 0 1 2 3 5 1请注意:所有这些数据(数字和那些.png图像)都来自服务器,我已经将它们处理并存储在NSMutableArray中。我只需要将它们显示在上面的分数表中,模拟器的屏幕截图就是我到目前为止所做的。
有人能告诉我有效处理/显示这些数据的最佳方法吗?
发布于 2013-05-03 19:38:59
一些想法:
1)搜索开源电子表格或多列类
2)对每一行、文本部分使用带制表位或其他固定间距的NSAttributedString。这将是我首选的解决方案,但您需要花费一些时间来弄清楚。
3)创建一个模板UITableviewCell子类,对左边的图片使用一个UIImageView,然后每个文本项使用一个UILabel。每一项都与左侧和右侧的其他项相邻。您可能会发现这是最简单的解决方案。
4)有几个HTML开放源码类可以接受HTML输入并为您生成属性字符串-请参见Cocanetics网站。
5)将数据转换为HTML表,并将其呈现在UIWebView中。
https://stackoverflow.com/questions/16350843
复制相似问题