I'm at a dead end (and probably blind to something incredibly obvious). I have a UITableView with which I want to do terribly normal things, for example, display text on every line. To do this, I used the usual delegate method tableView:cellForRowAtIndexPath: This is called expected. According to the docs, I have to create a UILabel object and set it as a textLabel property in a new UITableCell. But I collapsed with an unrecognized selector for setTextLabel: - the compiler properly warns me that it is not there. The legacy setText: method is used and works fine (with a warning). I definitely create against 3.0 libraries (I have no choice in disclosing other goals. Therefore, I am puzzled. What am I missing?
Thanks.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell * cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil] autorelease]; UILabel * label = [[[UILabel alloc] init] autorelease]; [label setText:@"Foo."]; [cell setTextLabel:label];
iphone uitableview
Ben zotto
source share