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 in开发者_C百科stead of cell then it also shows the values.. i dont know whats happening!!
help.
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
why are you using tbcell.text = aBook.Name; i think it cell.textLabel.text = aBook.Name;
加载中,请稍侯......
精彩评论