我想以編程方式在我的UITableView中設置文本。我不想從在tableView中設置文本
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
做到這一點我想是這樣
[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:0]].textField.text = @"test";
這不起作用,因爲這不是結構的一部分。我該怎麼做?一直在尋找文檔,但無法找到它。
爲什麼你不想在cellForRowAtIndexPath方法中做到這一點? – Anna 2010-10-22 02:45:17
我想加載我的tableView與來自ABPeoplePickerNavigationControllerDelegate的數據。所以我認爲從ABPeoplePickerNavigationControllerDelegate設置我的tableView.textField.text很容易。 – munchine 2010-10-22 02:56:49
現在無法給出詳細的答案,但是您應該將從ABPeoplePicker獲取的數據放入某個對象X並在cellForRowAtIndexPath中讀取該對象。在ABPeoplePicker完成後,您可以在表視圖上調用reloadData以使其顯示更新的數據。 – Anna 2010-10-22 03:05:43