开发者

setting text in tableView

I want to programatically set a text in my UITableView. I do not want to do it from

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

I tried something like

[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:0]].textField.text = @"te开发者_C百科st";

This doesn't work as this is not part of the structure. How do I do it? Been looking in the docs but cannot find it.


You want to use textLabel, not textField. This is, in general, a bad idea. You should provide the proper cell in -tableView:cellForRowAtIndexPath:. If you only want to adjust one cell, you can use -[UITableView reloadRowsAtIndexPaths:withRowAnimation:].

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜