Reputation: 1847
i am trying to get the value in UITableViewCell
but unable to get!!
here is my code:
- (UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
tbcell.text = aBook.Name;
return cell;
}
when i print this value then its showing in gdb and also when i use UITextField
instead of cell
then it also shows the values.. i dont know whats happening!!
help.
Upvotes: 3
Views: 662
Reputation: 1716
why are you using tbcell.text = aBook.Name;
i think it cell.textLabel.text = aBook.Name;
Upvotes: 0
Reputation: 14334
I'm not even sure what you're asking, but i'll try anyway as i see some weird stuff right away.
I'd replace
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
with
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
You were creating your cells with a frame with 0 values, i might be missing something if you're doing it on purpose though.
Also the "text" property of UITableViewCell is deprecated, use cell.textLabel.text instead
Upvotes: 2