2016-03-23 55 views

回答

0

只需編寫邏輯,你怎麼能動態地獲得關鍵值瞬間放一些常量來獲得該值。 查找下面的代碼以使用該邏輯獲取密鑰。

NSString *key = [NSString stringWithFormat:@"%d",indexPath.section+1]; 
NSString *text = [[[[dic objectForKey:key] objectAtIndex:indexPath.section]objectAtIndex:indexPath.row]valueForKey:@"h1"]; 
0

您必須稍微修改JSON結構,以便輕鬆使用tableview節設計。

贊,{ values:[{"section1":[ {"Row1 or some constant":}]}]} 通過這種方式,您可以輕鬆讀取數據。嘗試在一個數組中創建段,並在所有行中使用單獨的數組。

FYI:代碼格式化存在一些問題。我不知道如何解決。