1
中,讀取PList並在tableView控制器中設置cell.textLabel.text只是一個非常愚蠢的問題。從PList獲取單元格標題的問題在UITableView
我的plist看起來是這樣的:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>Rows</key>
<array>
<dict>
<key>Name</key>
<string>Big Ben</string>
</dict>
<dict>
<key>Name</key>
<string>Westminster Abbey</string>
</dict>
</array>
<key>Title</key>
<string>London</string>
</dict>
<dict>
<key>Rows</key>
<array>
<dict>
<key>Name</key>
<string>Eiffel Tower</string>
</dict>
</array>
<key>Title</key>
<string>Paris</string>
</dict>
</array>
</plist>
,我只是試圖讓名字進入細胞。這是我的目標。
cell.textLabel.text = [[[[[tableData objectAtIndex: indexPath.section] objectForKey: @"Rows"] objectAtIndex: indexPath.section] objectForKey: @"Name"] objectAtIndex: indexPath.row];
在此先感謝。
如果您將該行分成多個語句,您將更容易閱讀和調試。您可以一次一步或單步測試一件事,看看發生了什麼。 – Anna 2011-03-28 21:14:44
感謝您的建議 - 將做到這一點。 – 2011-03-28 21:33:05