简体   繁体   English

故事板中的自定义单元格不为零

[英]Custom Cell not nil in Storyboard

I created a custom cell in UITableView inside StoryBoard but its always return value not NULL(NIL) 我在StoryBoard的UITableView中创建了一个自定义单元格,但它的返回值始终不是NULL(NIL)

eg: CustomCell *cell = (CustomCell *)[tblView dequeueReusableCellWithIdentifier:identifier];
NSLog(@"%@",cell);

it return --> <CustomCell: 0x8352480; baseClass = UITableViewCell; frame = (0 0; 320 84); opaque = NO; autoresize = RM+BM; autoresizesSubviews = NO; layer = <CALayer: 0x834f680>>

I don't know why, i think customCell return nil when cell is not value; 我不知道为什么,当单元格不值时,我认为customCell返回nil。

Anybody say why, why customCell is not nil 有人说为什么,为什么customCell不为零

thanks 谢谢

Because from a storyboard, when you call dequeReuseableCellWithIdentifier: it creates the cell if there isn't one in the reuse queue. 因为从情节提要中,当您调用dequeReuseableCellWithIdentifier时:如果重用队列中没有单元,它将创建单元。

So you always get a cell by calling this method, not a nil. 因此,您总是通过调用此方法而不是nil来获得单元格。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM