我正在從事信息檢索的最新信息在UITableView的頂部。代碼是這樣的。UITableView不倒車
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
LoanModel* loan = _feed.products[indexPath.row];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" ];
if (cell == nil) {
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:@"Cell"];
}
NSString *myString = [NSString stringWithFormat:@"%@",[loan name]];
NSArray *myWords = [myString componentsSeparatedByString:@","];
NSMutableArray *reversed = [NSMutableArray arrayWithCapacity:[myWords count]];
NSEnumerator *enumerator = [myWords reverseObjectEnumerator];
for (id element in enumerator) {
[reversed addObject:element];
}
NSMutableString *reverseString = [reversed componentsJoinedByString:@","];
cell.textLabel.text = reverseString;
return cell;
}
我得到的JSON
對象分別包含兩個字段cid和name。我只顯示名稱是tableview。但我想反過來顯示它,最後更新應該首先顯示。但上面的代碼反過來顯示內容。如果「你好」是內容,那麼它顯示「olleh」。請告訴我如何獲得UITableView
的反向列表。我是iOS的新手。
myString的價值是什麼? – Buntylm 2013-05-09 08:06:33
你的意思是你想顯示你的tableview的單元格像o,l,l,e,h(反向)順序。? – 2013-05-09 08:06:43
根據你的代碼,你只用這種方法獲取feed沒有任何其他的權利? – 2013-05-09 08:07:35